{"action":"created","comment":{"url":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby/pulls/comments/36306678","id":36306678,"diff_hunk":"@@ -0,0 +1,85 @@\n+require \"spec_helper\"\n+\n+describe Myfinance::Resources::PayableAccount do\n+  describe \"#create\", vcr: true do\n+    let(:params) { { due_date: '2015-08-15', amount: 150.99 } }\n+    subject { client.payable_accounts.create(3798, params) }\n+\n+    context \"with success\" do\n+      it \"creates a new object\" do\n+        expect(subject.id).to eq(1215631)\n+        expect(subject.due_date).to eq(Date.new(2015, 8, 15))\n+        expect(subject.entity_id).to eq(3798)\n+        expect(subject.status).to eq(1)\n+        expect(subject.status_name).to eq('unpaid')\n+        expect(subject.occurred_at).to be_nil\n+        expect(subject.amount).to eq(150.99)\n+        expect(subject.ticket_amount).to be_nil\n+        expect(subject.interest_amount).to be_nil\n+        expect(subject.discount_amount).to be_nil\n+        expect(subject.total_amount).to be_nil\n+        expect(subject.description).to be_nil\n+        expect(subject.document).to be_nil\n+        expect(subject.document_emission_date).to be_nil\n+        expect(subject.observation).to be_nil\n+        expect(subject.remind).to be_falsy\n+        expect(subject.reminded_at).to be_nil\n+        expect(subject.income_tax_relevant).to be_falsy\n+        expect(subject.category_id).to be_nil\n+        expect(subject.classification_center_id).to be_nil\n+        expect(subject.expected_deposit_account_id).to be_nil\n+        expect(subject.recurrence_id).to be_nil\n+        expect(subject.person_id).to be_nil\n+        expect(subject.created_at).to eq(DateTime.parse(\"2015-08-05T10:31:28-03:00\"))\n+        expect(subject.updated_at).to eq(DateTime.parse(\"2015-08-05T10:31:28-03:00\"))\n+        expect(subject.recurrent).to be_falsy\n+        expect(subject.parcelled).to be_falsy\n+        expect(subject.recurrence_period).to be_nil\n+        expect(subject.number_of_parcels).to be_nil\n+        expect(subject.current_parcel).to be_nil\n+        expect(subject.competency_month).to eq(\"2015-08\")\n+        expect(subject.financial_account_taxes_attributes).to be_empty\n+      end\n+\n+      context \"when the payable_account has occurred_at value defined\" do\n+        let(:params) { { due_date: '2015-08-01', amount: 150.99, occurred_at: '2015-08-05', total_amount: 150.99 } }\n+\n+        it \"creates a new payable_account as paid\" do\n+          expect(subject.id).to eq(1215632)\n+          expect(subject.due_date).to eq(Date.new(2015, 8, 1))\n+          expect(subject.occurred_at).to eq(Date.new(2015, 8, 5))\n+          expect(subject.amount).to eq(150.99)\n+          expect(subject.total_amount).to eq(150.99)\n+          expect(subject.status).to eq(2)\n+          expect(subject.status_name).to eq('paid')\n+        end\n+      end\n+    end\n+\n+    context \"when any data is invalid\" do\n+      let(:params) { { due_date: '', amount: 150.99 } }\n+\n+      it \"raises Myfinance::RequestError\" do\n+        expect { subject }.to raise_error(Myfinance::RequestError)\n+      end\n+\n+      it \"adds information on request error object\" do\n+        expect(Myfinance::RequestError).to receive(:new).with(code: 422, message: \"\", body: \"{\\\"competency_month\\\":[\\\"n\\\\u00e3o pode ser vazio\\\"],\\\"due_date\\\":[\\\"n\\\\u00e3o \\\\u00e9 uma data v\\\\u00e1lida\\\"]}\").and_call_original\n+        expect { subject }.to raise_error(Myfinance::RequestError)\n+      end\n+    end\n+\n+    context \"when entity does not exist\" do\n+      subject { client.payable_accounts.create(555, params) }\n+\n+      it \"raises Myfinance::RequestError\" do\n+        expect { subject }.to raise_error(Myfinance::RequestError)\n+      end\n+\n+      it \"adds information on request error object\" do\n+        expect(Myfinance::RequestError).to receive(:new).with(code: 403, message: \"Forbidden\", body: \"{\\\"error\\\":\\\"Voc\\\\u00ea n\\\\u00e3o tem permiss\\\\u00e3o para acessar este recurso.\\\"}\").and_call_original","path":"spec/lib/myfinance/resources/payable_account_spec.rb","position":80,"original_position":80,"commit_id":"bb2fd3b28397e9dc68e26d3963f96e73ed4f194f","original_commit_id":"bb2fd3b28397e9dc68e26d3963f96e73ed4f194f","user":{"login":"houndci","id":6697940,"avatar_url":"https://avatars.githubusercontent.com/u/6697940?v=3","gravatar_id":"","url":"https://api.github.com/users/houndci","html_url":"https://github.com/houndci","followers_url":"https://api.github.com/users/houndci/followers","following_url":"https://api.github.com/users/houndci/following{/other_user}","gists_url":"https://api.github.com/users/houndci/gists{/gist_id}","starred_url":"https://api.github.com/users/houndci/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/houndci/subscriptions","organizations_url":"https://api.github.com/users/houndci/orgs","repos_url":"https://api.github.com/users/houndci/repos","events_url":"https://api.github.com/users/houndci/events{/privacy}","received_events_url":"https://api.github.com/users/houndci/received_events","type":"User","site_admin":false},"body":"Line is too long. [205/80]","created_at":"2015-08-05T14:23:11Z","updated_at":"2015-08-05T14:23:11Z","html_url":"https://github.com/myfreecomm/myfinance-client-ruby/pull/6#discussion_r36306678","pull_request_url":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby/pulls/6","_links":{"self":{"href":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby/pulls/comments/36306678"},"html":{"href":"https://github.com/myfreecomm/myfinance-client-ruby/pull/6#discussion_r36306678"},"pull_request":{"href":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby/pulls/6"}}},"pull_request":{"url":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby/pulls/6","id":41684185,"html_url":"https://github.com/myfreecomm/myfinance-client-ruby/pull/6","diff_url":"https://github.com/myfreecomm/myfinance-client-ruby/pull/6.diff","patch_url":"https://github.com/myfreecomm/myfinance-client-ruby/pull/6.patch","issue_url":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby/issues/6","number":6,"state":"open","locked":false,"title":"Create payable account endpoint","user":{"login":"eduardohertz","id":129768,"avatar_url":"https://avatars.githubusercontent.com/u/129768?v=3","gravatar_id":"","url":"https://api.github.com/users/eduardohertz","html_url":"https://github.com/eduardohertz","followers_url":"https://api.github.com/users/eduardohertz/followers","following_url":"https://api.github.com/users/eduardohertz/following{/other_user}","gists_url":"https://api.github.com/users/eduardohertz/gists{/gist_id}","starred_url":"https://api.github.com/users/eduardohertz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/eduardohertz/subscriptions","organizations_url":"https://api.github.com/users/eduardohertz/orgs","repos_url":"https://api.github.com/users/eduardohertz/repos","events_url":"https://api.github.com/users/eduardohertz/events{/privacy}","received_events_url":"https://api.github.com/users/eduardohertz/received_events","type":"User","site_admin":false},"body":"","created_at":"2015-08-05T14:23:06Z","updated_at":"2015-08-05T14:23:11Z","closed_at":null,"merged_at":null,"merge_commit_sha":"71d9ecbf6634a5632cf01d581b337bc4083020af","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby/pulls/6/commits","review_comments_url":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby/pulls/6/comments","review_comment_url":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby/pulls/comments{/number}","comments_url":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby/issues/6/comments","statuses_url":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby/statuses/bb2fd3b28397e9dc68e26d3963f96e73ed4f194f","head":{"label":"myfreecomm:feature-create-payable-account","ref":"feature-create-payable-account","sha":"bb2fd3b28397e9dc68e26d3963f96e73ed4f194f","user":{"login":"myfreecomm","id":86764,"avatar_url":"https://avatars.githubusercontent.com/u/86764?v=3","gravatar_id":"","url":"https://api.github.com/users/myfreecomm","html_url":"https://github.com/myfreecomm","followers_url":"https://api.github.com/users/myfreecomm/followers","following_url":"https://api.github.com/users/myfreecomm/following{/other_user}","gists_url":"https://api.github.com/users/myfreecomm/gists{/gist_id}","starred_url":"https://api.github.com/users/myfreecomm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/myfreecomm/subscriptions","organizations_url":"https://api.github.com/users/myfreecomm/orgs","repos_url":"https://api.github.com/users/myfreecomm/repos","events_url":"https://api.github.com/users/myfreecomm/events{/privacy}","received_events_url":"https://api.github.com/users/myfreecomm/received_events","type":"Organization","site_admin":false},"repo":{"id":8864909,"name":"myfinance-client-ruby","full_name":"myfreecomm/myfinance-client-ruby","owner":{"login":"myfreecomm","id":86764,"avatar_url":"https://avatars.githubusercontent.com/u/86764?v=3","gravatar_id":"","url":"https://api.github.com/users/myfreecomm","html_url":"https://github.com/myfreecomm","followers_url":"https://api.github.com/users/myfreecomm/followers","following_url":"https://api.github.com/users/myfreecomm/following{/other_user}","gists_url":"https://api.github.com/users/myfreecomm/gists{/gist_id}","starred_url":"https://api.github.com/users/myfreecomm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/myfreecomm/subscriptions","organizations_url":"https://api.github.com/users/myfreecomm/orgs","repos_url":"https://api.github.com/users/myfreecomm/repos","events_url":"https://api.github.com/users/myfreecomm/events{/privacy}","received_events_url":"https://api.github.com/users/myfreecomm/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/myfreecomm/myfinance-client-ruby","description":"A Ruby client for MyFinance's REST API","fork":false,"url":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby","forks_url":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby/forks","keys_url":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby/keys{/key_id}","collaborators_url":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby/teams","hooks_url":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby/hooks","issue_events_url":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby/issues/events{/number}","events_url":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby/events","assignees_url":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby/assignees{/user}","branches_url":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby/branches{/branch}","tags_url":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby/tags","blobs_url":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby/git/refs{/sha}","trees_url":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby/git/trees{/sha}","statuses_url":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby/statuses/{sha}","languages_url":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby/languages","stargazers_url":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby/stargazers","contributors_url":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby/contributors","subscribers_url":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby/subscribers","subscription_url":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby/subscription","commits_url":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby/commits{/sha}","git_commits_url":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby/git/commits{/sha}","comments_url":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby/comments{/number}","issue_comment_url":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby/issues/comments{/number}","contents_url":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby/contents/{+path}","compare_url":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby/compare/{base}...{head}","merges_url":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby/merges","archive_url":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby/downloads","issues_url":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby/issues{/number}","pulls_url":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby/pulls{/number}","milestones_url":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby/milestones{/number}","notifications_url":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby/labels{/name}","releases_url":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby/releases{/id}","created_at":"2013-03-18T21:42:53Z","updated_at":"2015-07-29T13:39:50Z","pushed_at":"2015-08-05T14:23:06Z","git_url":"git://github.com/myfreecomm/myfinance-client-ruby.git","ssh_url":"git@github.com:myfreecomm/myfinance-client-ruby.git","clone_url":"https://github.com/myfreecomm/myfinance-client-ruby.git","svn_url":"https://github.com/myfreecomm/myfinance-client-ruby","homepage":null,"size":208,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"myfreecomm:master","ref":"master","sha":"259e58d38aaf0276cdcaba5ac5c1b36f51d28b53","user":{"login":"myfreecomm","id":86764,"avatar_url":"https://avatars.githubusercontent.com/u/86764?v=3","gravatar_id":"","url":"https://api.github.com/users/myfreecomm","html_url":"https://github.com/myfreecomm","followers_url":"https://api.github.com/users/myfreecomm/followers","following_url":"https://api.github.com/users/myfreecomm/following{/other_user}","gists_url":"https://api.github.com/users/myfreecomm/gists{/gist_id}","starred_url":"https://api.github.com/users/myfreecomm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/myfreecomm/subscriptions","organizations_url":"https://api.github.com/users/myfreecomm/orgs","repos_url":"https://api.github.com/users/myfreecomm/repos","events_url":"https://api.github.com/users/myfreecomm/events{/privacy}","received_events_url":"https://api.github.com/users/myfreecomm/received_events","type":"Organization","site_admin":false},"repo":{"id":8864909,"name":"myfinance-client-ruby","full_name":"myfreecomm/myfinance-client-ruby","owner":{"login":"myfreecomm","id":86764,"avatar_url":"https://avatars.githubusercontent.com/u/86764?v=3","gravatar_id":"","url":"https://api.github.com/users/myfreecomm","html_url":"https://github.com/myfreecomm","followers_url":"https://api.github.com/users/myfreecomm/followers","following_url":"https://api.github.com/users/myfreecomm/following{/other_user}","gists_url":"https://api.github.com/users/myfreecomm/gists{/gist_id}","starred_url":"https://api.github.com/users/myfreecomm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/myfreecomm/subscriptions","organizations_url":"https://api.github.com/users/myfreecomm/orgs","repos_url":"https://api.github.com/users/myfreecomm/repos","events_url":"https://api.github.com/users/myfreecomm/events{/privacy}","received_events_url":"https://api.github.com/users/myfreecomm/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/myfreecomm/myfinance-client-ruby","description":"A Ruby client for MyFinance's REST API","fork":false,"url":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby","forks_url":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby/forks","keys_url":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby/keys{/key_id}","collaborators_url":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby/teams","hooks_url":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby/hooks","issue_events_url":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby/issues/events{/number}","events_url":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby/events","assignees_url":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby/assignees{/user}","branches_url":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby/branches{/branch}","tags_url":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby/tags","blobs_url":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby/git/refs{/sha}","trees_url":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby/git/trees{/sha}","statuses_url":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby/statuses/{sha}","languages_url":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby/languages","stargazers_url":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby/stargazers","contributors_url":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby/contributors","subscribers_url":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby/subscribers","subscription_url":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby/subscription","commits_url":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby/commits{/sha}","git_commits_url":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby/git/commits{/sha}","comments_url":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby/comments{/number}","issue_comment_url":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby/issues/comments{/number}","contents_url":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby/contents/{+path}","compare_url":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby/compare/{base}...{head}","merges_url":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby/merges","archive_url":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby/downloads","issues_url":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby/issues{/number}","pulls_url":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby/pulls{/number}","milestones_url":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby/milestones{/number}","notifications_url":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby/labels{/name}","releases_url":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby/releases{/id}","created_at":"2013-03-18T21:42:53Z","updated_at":"2015-07-29T13:39:50Z","pushed_at":"2015-08-05T14:23:06Z","git_url":"git://github.com/myfreecomm/myfinance-client-ruby.git","ssh_url":"git@github.com:myfreecomm/myfinance-client-ruby.git","clone_url":"https://github.com/myfreecomm/myfinance-client-ruby.git","svn_url":"https://github.com/myfreecomm/myfinance-client-ruby","homepage":null,"size":208,"stargazers_count":0,"watchers_count":0,"language":"Ruby","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby/pulls/6"},"html":{"href":"https://github.com/myfreecomm/myfinance-client-ruby/pull/6"},"issue":{"href":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby/issues/6"},"comments":{"href":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby/issues/6/comments"},"review_comments":{"href":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby/pulls/6/comments"},"review_comment":{"href":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby/pulls/6/commits"},"statuses":{"href":"https://api.github.com/repos/myfreecomm/myfinance-client-ruby/statuses/bb2fd3b28397e9dc68e26d3963f96e73ed4f194f"}}}}