{"action":"created","comment":{"url":"https://api.github.com/repos/mercadopago/px-java/pulls/comments/86690001","pull_request_review_id":7335855,"id":86690001,"diff_hunk":"@@ -0,0 +1,184 @@\n+package com.mercadopago;\n+\n+import com.mercadopago.exceptions.MPConfException;\n+import org.apache.commons.lang3.StringUtils;\n+\n+import java.io.InputStream;\n+import java.util.HashMap;\n+import java.util.Properties;\n+\n+/**\n+ * Mercado Pago SDK\n+ * MPConf Class\n+ *\n+ * Created by Eduardo Paoletta on 11/1/16.\n+ */\n+public class MPConf {\n+\n+    private static final String DEFAULT_BASE_URL = \"https://api.mercadopago.com\";\n+\n+    private static String clientSecret = null;\n+    private static String clientId = null;\n+    private static String accessToken = null;\n+    private static String appId = null;\n+    private static String baseUrl = DEFAULT_BASE_URL;\n+\n+    /**\n+     * Getter/Setter for ClientSecret\n+     */\n+    public static String getClientSecret() {\n+        return clientSecret;\n+    }\n+\n+    public static void setClientSecret(String value) throws MPConfException {\n+        if (StringUtils.isNotEmpty(clientSecret))\n+            throw new MPConfException(\"clientSecret setting can not be changed\");\n+        clientSecret = value;\n+    }\n+\n+    /**\n+     * Getter/Setter for ClientId\n+     */\n+    public static String getClientId() {\n+        return clientId;\n+    }\n+\n+    public static void setClientId(String value) throws MPConfException {\n+        if (StringUtils.isNotEmpty(clientId))\n+            throw new MPConfException(\"clientId setting can not be changed\");\n+        clientId = value;\n+    }\n+\n+    /**\n+     * Getter/Setter for AccessToken\n+     */\n+    public static String getAccessToken() {\n+        return accessToken;\n+    }\n+\n+    public static void setAccessToken(String value) throws MPConfException {\n+        if (StringUtils.isNotEmpty(accessToken))\n+            throw new MPConfException(\"accessToken setting can not be changed\");\n+        accessToken = value;\n+    }\n+\n+    /**\n+     * Getter/Setter for AppId\n+     */\n+    public static String getAppId() {\n+        return appId;\n+    }\n+\n+    public static void setAppId(String value) throws MPConfException {\n+        if (StringUtils.isNotEmpty(appId))\n+            throw new MPConfException(\"appId setting can not be changed\");\n+        appId = value;\n+    }\n+\n+    /**\n+     * Getter/Setter for BaseUrl\n+     * (FOR TESTING ONLY)\n+     */\n+    public static String getBaseUrl() {\n+        return baseUrl;\n+    }\n+\n+    public static void setBaseUrl(String value) {\n+        baseUrl = value;\n+    }\n+\n+    /**\n+     * Set configuration params with a hashmap.\n+     * Valid keys are: clientSecret, clientId, accessToken, appId\n+     * @param hashConfigurationParams a <String, String> hashmap with the configuration params\n+     * throws MPConfException\n+     */\n+    public static void setConfiguration(HashMap<String, String> hashConfigurationParams) throws MPConfException {\n+        if (hashConfigurationParams == null)\n+            throw new IllegalArgumentException(\"Invalid hashConfigurationParams parameter\");\n+\n+        setClientSecret(getValueFromHashMap(hashConfigurationParams, \"clientSecret\"));\n+        setClientId(getValueFromHashMap(hashConfigurationParams, \"clientId\"));\n+        setAccessToken(getValueFromHashMap(hashConfigurationParams, \"accessToken\"));\n+        setAppId(getValueFromHashMap(hashConfigurationParams, \"appId\"));\n+    }\n+\n+    /**\n+     * Extract a value from a HashMap and validate that is not null or empty\n+     * @param hashMap a <String, String> hashmap with the configuration params.\n+     * @param key value key\n+     * @return the configuration param\n+     */\n+    private static String getValueFromHashMap(HashMap<String, String> hashMap, String key) {\n+        if (hashMap.containsKey(key) &&\n+                StringUtils.isNotEmpty(hashMap.get(key)))\n+            return hashMap.get(key);\n+        else\n+            throw new IllegalArgumentException(String.format(\"Invalid %s value\", key));\n+    }\n+\n+    /**\n+     * Set configuration params with a properties file\n+     * @param filePath the path of the properties file\n+     * throws MPConfException\n+     */\n+    public static void setConfiguration(String filePath) throws MPConfException {\n+        if (StringUtils.isEmpty(filePath))","path":"src/com/mercadopago/MPConf.java","position":126,"original_position":126,"commit_id":"b7efb675d5e761269e8c73a3a08ad40d54068687","original_commit_id":"b7efb675d5e761269e8c73a3a08ad40d54068687","user":{"login":"hdlopez","id":3875628,"avatar_url":"https://avatars.githubusercontent.com/u/3875628?v=3","gravatar_id":"","url":"https://api.github.com/users/hdlopez","html_url":"https://github.com/hdlopez","followers_url":"https://api.github.com/users/hdlopez/followers","following_url":"https://api.github.com/users/hdlopez/following{/other_user}","gists_url":"https://api.github.com/users/hdlopez/gists{/gist_id}","starred_url":"https://api.github.com/users/hdlopez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hdlopez/subscriptions","organizations_url":"https://api.github.com/users/hdlopez/orgs","repos_url":"https://api.github.com/users/hdlopez/repos","events_url":"https://api.github.com/users/hdlopez/events{/privacy}","received_events_url":"https://api.github.com/users/hdlopez/received_events","type":"User","site_admin":false},"body":"Genial lo del StringUtils 👍 . No recordaba que soportaba null también. Respecto al overload luego te consulto porque no sé si entendí muy bien.","created_at":"2016-11-06T16:25:49Z","updated_at":"2016-11-06T16:25:49Z","html_url":"https://github.com/mercadopago/px-java/pull/4#discussion_r86690001","pull_request_url":"https://api.github.com/repos/mercadopago/px-java/pulls/4","_links":{"self":{"href":"https://api.github.com/repos/mercadopago/px-java/pulls/comments/86690001"},"html":{"href":"https://github.com/mercadopago/px-java/pull/4#discussion_r86690001"},"pull_request":{"href":"https://api.github.com/repos/mercadopago/px-java/pulls/4"}}},"pull_request":{"url":"https://api.github.com/repos/mercadopago/px-java/pulls/4","id":91990206,"html_url":"https://github.com/mercadopago/px-java/pull/4","diff_url":"https://github.com/mercadopago/px-java/pull/4.diff","patch_url":"https://github.com/mercadopago/px-java/pull/4.patch","issue_url":"https://api.github.com/repos/mercadopago/px-java/issues/4","number":4,"state":"open","locked":false,"title":"Px java config class issue 1","user":{"login":"eduardopaoletta","id":22988344,"avatar_url":"https://avatars.githubusercontent.com/u/22988344?v=3","gravatar_id":"","url":"https://api.github.com/users/eduardopaoletta","html_url":"https://github.com/eduardopaoletta","followers_url":"https://api.github.com/users/eduardopaoletta/followers","following_url":"https://api.github.com/users/eduardopaoletta/following{/other_user}","gists_url":"https://api.github.com/users/eduardopaoletta/gists{/gist_id}","starred_url":"https://api.github.com/users/eduardopaoletta/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eduardopaoletta/subscriptions","organizations_url":"https://api.github.com/users/eduardopaoletta/orgs","repos_url":"https://api.github.com/users/eduardopaoletta/repos","events_url":"https://api.github.com/users/eduardopaoletta/events{/privacy}","received_events_url":"https://api.github.com/users/eduardopaoletta/received_events","type":"User","site_admin":false},"body":"Basic project structure\r\nAdded Main class\r\nAdded Base exception class\r\nAdded Configuration class\r\nAdded Configuration exception class\r\nTests","created_at":"2016-11-02T15:15:24Z","updated_at":"2016-11-06T16:25:49Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2170d34114e732984bfc828e48a7628024711b1e","assignee":{"login":"hdlopez","id":3875628,"avatar_url":"https://avatars.githubusercontent.com/u/3875628?v=3","gravatar_id":"","url":"https://api.github.com/users/hdlopez","html_url":"https://github.com/hdlopez","followers_url":"https://api.github.com/users/hdlopez/followers","following_url":"https://api.github.com/users/hdlopez/following{/other_user}","gists_url":"https://api.github.com/users/hdlopez/gists{/gist_id}","starred_url":"https://api.github.com/users/hdlopez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hdlopez/subscriptions","organizations_url":"https://api.github.com/users/hdlopez/orgs","repos_url":"https://api.github.com/users/hdlopez/repos","events_url":"https://api.github.com/users/hdlopez/events{/privacy}","received_events_url":"https://api.github.com/users/hdlopez/received_events","type":"User","site_admin":false},"assignees":[{"login":"hdlopez","id":3875628,"avatar_url":"https://avatars.githubusercontent.com/u/3875628?v=3","gravatar_id":"","url":"https://api.github.com/users/hdlopez","html_url":"https://github.com/hdlopez","followers_url":"https://api.github.com/users/hdlopez/followers","following_url":"https://api.github.com/users/hdlopez/following{/other_user}","gists_url":"https://api.github.com/users/hdlopez/gists{/gist_id}","starred_url":"https://api.github.com/users/hdlopez/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/hdlopez/subscriptions","organizations_url":"https://api.github.com/users/hdlopez/orgs","repos_url":"https://api.github.com/users/hdlopez/repos","events_url":"https://api.github.com/users/hdlopez/events{/privacy}","received_events_url":"https://api.github.com/users/hdlopez/received_events","type":"User","site_admin":false}],"milestone":null,"commits_url":"https://api.github.com/repos/mercadopago/px-java/pulls/4/commits","review_comments_url":"https://api.github.com/repos/mercadopago/px-java/pulls/4/comments","review_comment_url":"https://api.github.com/repos/mercadopago/px-java/pulls/comments{/number}","comments_url":"https://api.github.com/repos/mercadopago/px-java/issues/4/comments","statuses_url":"https://api.github.com/repos/mercadopago/px-java/statuses/b7efb675d5e761269e8c73a3a08ad40d54068687","head":{"label":"mercadopago:px-java-config_class-issue_1","ref":"px-java-config_class-issue_1","sha":"b7efb675d5e761269e8c73a3a08ad40d54068687","user":{"login":"mercadopago","id":900583,"avatar_url":"https://avatars.githubusercontent.com/u/900583?v=3","gravatar_id":"","url":"https://api.github.com/users/mercadopago","html_url":"https://github.com/mercadopago","followers_url":"https://api.github.com/users/mercadopago/followers","following_url":"https://api.github.com/users/mercadopago/following{/other_user}","gists_url":"https://api.github.com/users/mercadopago/gists{/gist_id}","starred_url":"https://api.github.com/users/mercadopago/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mercadopago/subscriptions","organizations_url":"https://api.github.com/users/mercadopago/orgs","repos_url":"https://api.github.com/users/mercadopago/repos","events_url":"https://api.github.com/users/mercadopago/events{/privacy}","received_events_url":"https://api.github.com/users/mercadopago/received_events","type":"Organization","site_admin":false},"repo":{"id":72488753,"name":"px-java","full_name":"mercadopago/px-java","owner":{"login":"mercadopago","id":900583,"avatar_url":"https://avatars.githubusercontent.com/u/900583?v=3","gravatar_id":"","url":"https://api.github.com/users/mercadopago","html_url":"https://github.com/mercadopago","followers_url":"https://api.github.com/users/mercadopago/followers","following_url":"https://api.github.com/users/mercadopago/following{/other_user}","gists_url":"https://api.github.com/users/mercadopago/gists{/gist_id}","starred_url":"https://api.github.com/users/mercadopago/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mercadopago/subscriptions","organizations_url":"https://api.github.com/users/mercadopago/orgs","repos_url":"https://api.github.com/users/mercadopago/repos","events_url":"https://api.github.com/users/mercadopago/events{/privacy}","received_events_url":"https://api.github.com/users/mercadopago/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mercadopago/px-java","description":"MercadoPago SDK Java - BETA ","fork":false,"url":"https://api.github.com/repos/mercadopago/px-java","forks_url":"https://api.github.com/repos/mercadopago/px-java/forks","keys_url":"https://api.github.com/repos/mercadopago/px-java/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mercadopago/px-java/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mercadopago/px-java/teams","hooks_url":"https://api.github.com/repos/mercadopago/px-java/hooks","issue_events_url":"https://api.github.com/repos/mercadopago/px-java/issues/events{/number}","events_url":"https://api.github.com/repos/mercadopago/px-java/events","assignees_url":"https://api.github.com/repos/mercadopago/px-java/assignees{/user}","branches_url":"https://api.github.com/repos/mercadopago/px-java/branches{/branch}","tags_url":"https://api.github.com/repos/mercadopago/px-java/tags","blobs_url":"https://api.github.com/repos/mercadopago/px-java/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mercadopago/px-java/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mercadopago/px-java/git/refs{/sha}","trees_url":"https://api.github.com/repos/mercadopago/px-java/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mercadopago/px-java/statuses/{sha}","languages_url":"https://api.github.com/repos/mercadopago/px-java/languages","stargazers_url":"https://api.github.com/repos/mercadopago/px-java/stargazers","contributors_url":"https://api.github.com/repos/mercadopago/px-java/contributors","subscribers_url":"https://api.github.com/repos/mercadopago/px-java/subscribers","subscription_url":"https://api.github.com/repos/mercadopago/px-java/subscription","commits_url":"https://api.github.com/repos/mercadopago/px-java/commits{/sha}","git_commits_url":"https://api.github.com/repos/mercadopago/px-java/git/commits{/sha}","comments_url":"https://api.github.com/repos/mercadopago/px-java/comments{/number}","issue_comment_url":"https://api.github.com/repos/mercadopago/px-java/issues/comments{/number}","contents_url":"https://api.github.com/repos/mercadopago/px-java/contents/{+path}","compare_url":"https://api.github.com/repos/mercadopago/px-java/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mercadopago/px-java/merges","archive_url":"https://api.github.com/repos/mercadopago/px-java/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mercadopago/px-java/downloads","issues_url":"https://api.github.com/repos/mercadopago/px-java/issues{/number}","pulls_url":"https://api.github.com/repos/mercadopago/px-java/pulls{/number}","milestones_url":"https://api.github.com/repos/mercadopago/px-java/milestones{/number}","notifications_url":"https://api.github.com/repos/mercadopago/px-java/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mercadopago/px-java/labels{/name}","releases_url":"https://api.github.com/repos/mercadopago/px-java/releases{/id}","deployments_url":"https://api.github.com/repos/mercadopago/px-java/deployments","created_at":"2016-11-01T00:12:29Z","updated_at":"2016-11-01T18:06:45Z","pushed_at":"2016-11-04T17:26:42Z","git_url":"git://github.com/mercadopago/px-java.git","ssh_url":"git@github.com:mercadopago/px-java.git","clone_url":"https://github.com/mercadopago/px-java.git","svn_url":"https://github.com/mercadopago/px-java","homepage":"","size":18,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":4,"forks":0,"open_issues":4,"watchers":0,"default_branch":"master"}},"base":{"label":"mercadopago:develop","ref":"develop","sha":"9ee84b6ad09e966ab6cd748700f684d3aed00bb3","user":{"login":"mercadopago","id":900583,"avatar_url":"https://avatars.githubusercontent.com/u/900583?v=3","gravatar_id":"","url":"https://api.github.com/users/mercadopago","html_url":"https://github.com/mercadopago","followers_url":"https://api.github.com/users/mercadopago/followers","following_url":"https://api.github.com/users/mercadopago/following{/other_user}","gists_url":"https://api.github.com/users/mercadopago/gists{/gist_id}","starred_url":"https://api.github.com/users/mercadopago/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mercadopago/subscriptions","organizations_url":"https://api.github.com/users/mercadopago/orgs","repos_url":"https://api.github.com/users/mercadopago/repos","events_url":"https://api.github.com/users/mercadopago/events{/privacy}","received_events_url":"https://api.github.com/users/mercadopago/received_events","type":"Organization","site_admin":false},"repo":{"id":72488753,"name":"px-java","full_name":"mercadopago/px-java","owner":{"login":"mercadopago","id":900583,"avatar_url":"https://avatars.githubusercontent.com/u/900583?v=3","gravatar_id":"","url":"https://api.github.com/users/mercadopago","html_url":"https://github.com/mercadopago","followers_url":"https://api.github.com/users/mercadopago/followers","following_url":"https://api.github.com/users/mercadopago/following{/other_user}","gists_url":"https://api.github.com/users/mercadopago/gists{/gist_id}","starred_url":"https://api.github.com/users/mercadopago/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mercadopago/subscriptions","organizations_url":"https://api.github.com/users/mercadopago/orgs","repos_url":"https://api.github.com/users/mercadopago/repos","events_url":"https://api.github.com/users/mercadopago/events{/privacy}","received_events_url":"https://api.github.com/users/mercadopago/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/mercadopago/px-java","description":"MercadoPago SDK Java - BETA ","fork":false,"url":"https://api.github.com/repos/mercadopago/px-java","forks_url":"https://api.github.com/repos/mercadopago/px-java/forks","keys_url":"https://api.github.com/repos/mercadopago/px-java/keys{/key_id}","collaborators_url":"https://api.github.com/repos/mercadopago/px-java/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/mercadopago/px-java/teams","hooks_url":"https://api.github.com/repos/mercadopago/px-java/hooks","issue_events_url":"https://api.github.com/repos/mercadopago/px-java/issues/events{/number}","events_url":"https://api.github.com/repos/mercadopago/px-java/events","assignees_url":"https://api.github.com/repos/mercadopago/px-java/assignees{/user}","branches_url":"https://api.github.com/repos/mercadopago/px-java/branches{/branch}","tags_url":"https://api.github.com/repos/mercadopago/px-java/tags","blobs_url":"https://api.github.com/repos/mercadopago/px-java/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/mercadopago/px-java/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/mercadopago/px-java/git/refs{/sha}","trees_url":"https://api.github.com/repos/mercadopago/px-java/git/trees{/sha}","statuses_url":"https://api.github.com/repos/mercadopago/px-java/statuses/{sha}","languages_url":"https://api.github.com/repos/mercadopago/px-java/languages","stargazers_url":"https://api.github.com/repos/mercadopago/px-java/stargazers","contributors_url":"https://api.github.com/repos/mercadopago/px-java/contributors","subscribers_url":"https://api.github.com/repos/mercadopago/px-java/subscribers","subscription_url":"https://api.github.com/repos/mercadopago/px-java/subscription","commits_url":"https://api.github.com/repos/mercadopago/px-java/commits{/sha}","git_commits_url":"https://api.github.com/repos/mercadopago/px-java/git/commits{/sha}","comments_url":"https://api.github.com/repos/mercadopago/px-java/comments{/number}","issue_comment_url":"https://api.github.com/repos/mercadopago/px-java/issues/comments{/number}","contents_url":"https://api.github.com/repos/mercadopago/px-java/contents/{+path}","compare_url":"https://api.github.com/repos/mercadopago/px-java/compare/{base}...{head}","merges_url":"https://api.github.com/repos/mercadopago/px-java/merges","archive_url":"https://api.github.com/repos/mercadopago/px-java/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/mercadopago/px-java/downloads","issues_url":"https://api.github.com/repos/mercadopago/px-java/issues{/number}","pulls_url":"https://api.github.com/repos/mercadopago/px-java/pulls{/number}","milestones_url":"https://api.github.com/repos/mercadopago/px-java/milestones{/number}","notifications_url":"https://api.github.com/repos/mercadopago/px-java/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/mercadopago/px-java/labels{/name}","releases_url":"https://api.github.com/repos/mercadopago/px-java/releases{/id}","deployments_url":"https://api.github.com/repos/mercadopago/px-java/deployments","created_at":"2016-11-01T00:12:29Z","updated_at":"2016-11-01T18:06:45Z","pushed_at":"2016-11-04T17:26:42Z","git_url":"git://github.com/mercadopago/px-java.git","ssh_url":"git@github.com:mercadopago/px-java.git","clone_url":"https://github.com/mercadopago/px-java.git","svn_url":"https://github.com/mercadopago/px-java","homepage":"","size":18,"stargazers_count":0,"watchers_count":0,"language":null,"has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":4,"forks":0,"open_issues":4,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/mercadopago/px-java/pulls/4"},"html":{"href":"https://github.com/mercadopago/px-java/pull/4"},"issue":{"href":"https://api.github.com/repos/mercadopago/px-java/issues/4"},"comments":{"href":"https://api.github.com/repos/mercadopago/px-java/issues/4/comments"},"review_comments":{"href":"https://api.github.com/repos/mercadopago/px-java/pulls/4/comments"},"review_comment":{"href":"https://api.github.com/repos/mercadopago/px-java/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/mercadopago/px-java/pulls/4/commits"},"statuses":{"href":"https://api.github.com/repos/mercadopago/px-java/statuses/b7efb675d5e761269e8c73a3a08ad40d54068687"}}}}
{"actor":{"display_login":"hdlopez"}}