myfinance 1.2.1 → 1.3.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +3 -2
- data/.hound.yml +3 -1063
- data/.overcommit.yml +33 -0
- data/.rubocop.yml +19 -1131
- data/CHANGELOG.md +3 -0
- data/Gemfile.lock +3 -1
- data/README.md +200 -0
- data/Rakefile +1 -1
- data/bin/rspec +21 -0
- data/lib/myfinance.rb +4 -59
- data/lib/myfinance/client.rb +14 -2
- data/lib/myfinance/configuration.rb +2 -2
- data/lib/myfinance/entities/collection.rb +13 -5
- data/lib/myfinance/entities/sale.rb +32 -0
- data/lib/myfinance/entities/sale_account.rb +18 -0
- data/lib/myfinance/entities/sale_account_collection.rb +13 -0
- data/lib/myfinance/entities/sale_collection.rb +13 -0
- data/lib/myfinance/entities/sale_rule.rb +16 -0
- data/lib/myfinance/entities/sale_rule_collection.rb +13 -0
- data/lib/myfinance/http.rb +10 -11
- data/lib/myfinance/request.rb +2 -3
- data/lib/myfinance/resources/base.rb +1 -1
- data/lib/myfinance/resources/sale.rb +39 -0
- data/lib/myfinance/resources/sale_account.rb +39 -0
- data/lib/myfinance/resources/sale_rule.rb +39 -0
- data/lib/myfinance/response.rb +6 -6
- data/lib/myfinance/version.rb +1 -1
- data/myfinance.gemspec +14 -9
- data/spec/lib/myfinance/client_spec.rb +14 -0
- data/spec/lib/myfinance/entities/sale_account_collection_spec.rb +5 -0
- data/spec/lib/myfinance/entities/sale_account_spec.rb +18 -0
- data/spec/lib/myfinance/entities/sale_collection_spec.rb +5 -0
- data/spec/lib/myfinance/entities/sale_rule_collection_spec.rb +5 -0
- data/spec/lib/myfinance/entities/sale_rule_spec.rb +16 -0
- data/spec/lib/myfinance/entities/sale_spec.rb +32 -0
- data/spec/lib/myfinance/resources/sale_account.spec.rb +124 -0
- data/spec/lib/myfinance/resources/sale_account_spec.rb +116 -0
- data/spec/lib/myfinance/resources/sale_rule_spec.rb +126 -0
- data/spec/lib/myfinance/resources/sale_spec.rb +126 -0
- data/spec/support/shared_examples/entity_collection.rb +21 -0
- data/spec/support/shared_examples/http_request_methods.rb +12 -5
- metadata +51 -3
@@ -0,0 +1,21 @@
|
|
1
|
+
shared_examples :entity_collection do |entity_type|
|
2
|
+
let(:params) { double(headers: {}, parsed_body: [{}]) }
|
3
|
+
|
4
|
+
subject { described_class.new(params) }
|
5
|
+
|
6
|
+
context "#build" do
|
7
|
+
it "returns a collection(#{described_class})" do
|
8
|
+
expect(subject.build).to be_a(described_class)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
|
12
|
+
context "#collection" do
|
13
|
+
before :each do
|
14
|
+
subject.build
|
15
|
+
end
|
16
|
+
|
17
|
+
it "returns items(#{entity_type})" do
|
18
|
+
expect(subject.collection).to all(be_a(entity_type))
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -1,26 +1,33 @@
|
|
1
|
-
shared_examples
|
1
|
+
shared_examples "available http request methods" do
|
2
2
|
it "instantiates a new Request object" do
|
3
3
|
VCR.use_cassette("client/#{http_method}/request") do
|
4
|
-
expect(Myfinance::Request).to receive(:new).with(
|
4
|
+
expect(Myfinance::Request).to receive(:new).with(
|
5
|
+
body: params,
|
6
|
+
method: http_method,
|
7
|
+
token: "b552dd5a8598ca089b91c5e355a83b86e4696aefac9eaa05",
|
8
|
+
url: "#{Myfinance.configuration.url}#{url}",
|
9
|
+
user_agent: "Myfinance Ruby Client v#{Myfinance::VERSION}",
|
10
|
+
account_id: account_id
|
11
|
+
).and_call_original
|
5
12
|
subject.send(http_method, url, body: params)
|
6
13
|
end
|
7
14
|
end
|
8
15
|
|
9
|
-
it
|
16
|
+
it "runs the request" do
|
10
17
|
VCR.use_cassette("client/#{http_method}/request") do
|
11
18
|
expect_any_instance_of(Myfinance::Request).to receive(:run).and_call_original
|
12
19
|
subject.send(http_method, url, body: params)
|
13
20
|
end
|
14
21
|
end
|
15
22
|
|
16
|
-
it
|
23
|
+
it "instantiates a new Response object" do
|
17
24
|
VCR.use_cassette("client/#{http_method}/request") do
|
18
25
|
expect(Myfinance::Response).to receive(:new).and_call_original
|
19
26
|
subject.send(http_method, url, body: params)
|
20
27
|
end
|
21
28
|
end
|
22
29
|
|
23
|
-
it
|
30
|
+
it "resolves the response of the request a new Response object" do
|
24
31
|
VCR.use_cassette("client/#{http_method}/request") do
|
25
32
|
expect_any_instance_of(Myfinance::Response).to receive(:resolve!).and_call_original
|
26
33
|
subject.send(http_method, url, body: params)
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: myfinance
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Eduardo Hertz
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2017-
|
14
|
+
date: 2017-06-12 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: typhoeus
|
@@ -69,6 +69,20 @@ dependencies:
|
|
69
69
|
- - "~>"
|
70
70
|
- !ruby/object:Gem::Version
|
71
71
|
version: '2.99'
|
72
|
+
- !ruby/object:Gem::Dependency
|
73
|
+
name: require_all
|
74
|
+
requirement: !ruby/object:Gem::Requirement
|
75
|
+
requirements:
|
76
|
+
- - "~>"
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: 1.4.0
|
79
|
+
type: :runtime
|
80
|
+
prerelease: false
|
81
|
+
version_requirements: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - "~>"
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: 1.4.0
|
72
86
|
- !ruby/object:Gem::Dependency
|
73
87
|
name: bundler
|
74
88
|
requirement: !ruby/object:Gem::Requirement
|
@@ -217,6 +231,7 @@ email:
|
|
217
231
|
- rodrigo@pittlandia.net
|
218
232
|
executables:
|
219
233
|
- console
|
234
|
+
- rspec
|
220
235
|
- setup
|
221
236
|
extensions: []
|
222
237
|
extra_rdoc_files: []
|
@@ -225,6 +240,7 @@ files:
|
|
225
240
|
- ".coveralls.yml"
|
226
241
|
- ".gitignore"
|
227
242
|
- ".hound.yml"
|
243
|
+
- ".overcommit.yml"
|
228
244
|
- ".rspec"
|
229
245
|
- ".rubocop.yml"
|
230
246
|
- ".travis.yml"
|
@@ -235,6 +251,7 @@ files:
|
|
235
251
|
- README.md
|
236
252
|
- Rakefile
|
237
253
|
- bin/console
|
254
|
+
- bin/rspec
|
238
255
|
- bin/setup
|
239
256
|
- lib/myfinance.rb
|
240
257
|
- lib/myfinance/client.rb
|
@@ -268,6 +285,12 @@ files:
|
|
268
285
|
- lib/myfinance/entities/receivable_account.rb
|
269
286
|
- lib/myfinance/entities/receivable_account_collection.rb
|
270
287
|
- lib/myfinance/entities/reconcile_collection.rb
|
288
|
+
- lib/myfinance/entities/sale.rb
|
289
|
+
- lib/myfinance/entities/sale_account.rb
|
290
|
+
- lib/myfinance/entities/sale_account_collection.rb
|
291
|
+
- lib/myfinance/entities/sale_collection.rb
|
292
|
+
- lib/myfinance/entities/sale_rule.rb
|
293
|
+
- lib/myfinance/entities/sale_rule_collection.rb
|
271
294
|
- lib/myfinance/entities/tax.rb
|
272
295
|
- lib/myfinance/entities/tax_collection.rb
|
273
296
|
- lib/myfinance/entities/webhook.rb
|
@@ -291,6 +314,9 @@ files:
|
|
291
314
|
- lib/myfinance/resources/person.rb
|
292
315
|
- lib/myfinance/resources/receivable_account.rb
|
293
316
|
- lib/myfinance/resources/reconcile.rb
|
317
|
+
- lib/myfinance/resources/sale.rb
|
318
|
+
- lib/myfinance/resources/sale_account.rb
|
319
|
+
- lib/myfinance/resources/sale_rule.rb
|
294
320
|
- lib/myfinance/resources/tax.rb
|
295
321
|
- lib/myfinance/resources/webhook.rb
|
296
322
|
- lib/myfinance/response.rb
|
@@ -323,6 +349,12 @@ files:
|
|
323
349
|
- spec/lib/myfinance/entities/person_spec.rb
|
324
350
|
- spec/lib/myfinance/entities/receivable_account_spec.rb
|
325
351
|
- spec/lib/myfinance/entities/reconcile_collection_spec.rb
|
352
|
+
- spec/lib/myfinance/entities/sale_account_collection_spec.rb
|
353
|
+
- spec/lib/myfinance/entities/sale_account_spec.rb
|
354
|
+
- spec/lib/myfinance/entities/sale_collection_spec.rb
|
355
|
+
- spec/lib/myfinance/entities/sale_rule_collection_spec.rb
|
356
|
+
- spec/lib/myfinance/entities/sale_rule_spec.rb
|
357
|
+
- spec/lib/myfinance/entities/sale_spec.rb
|
326
358
|
- spec/lib/myfinance/entities/tax_collection_spec.rb
|
327
359
|
- spec/lib/myfinance/entities/tax_spec.rb
|
328
360
|
- spec/lib/myfinance/entities/webhook_collection_spec.rb
|
@@ -343,6 +375,10 @@ files:
|
|
343
375
|
- spec/lib/myfinance/resources/person_spec.rb
|
344
376
|
- spec/lib/myfinance/resources/receivable_account_spec.rb
|
345
377
|
- spec/lib/myfinance/resources/reconcile_spec.rb
|
378
|
+
- spec/lib/myfinance/resources/sale_account.spec.rb
|
379
|
+
- spec/lib/myfinance/resources/sale_account_spec.rb
|
380
|
+
- spec/lib/myfinance/resources/sale_rule_spec.rb
|
381
|
+
- spec/lib/myfinance/resources/sale_spec.rb
|
346
382
|
- spec/lib/myfinance/resources/tax_spec.rb
|
347
383
|
- spec/lib/myfinance/resources/webhook_spec.rb
|
348
384
|
- spec/lib/myfinance/response_spec.rb
|
@@ -353,6 +389,7 @@ files:
|
|
353
389
|
- spec/support/client.rb
|
354
390
|
- spec/support/matchers/have_attr_accessor.rb
|
355
391
|
- spec/support/shared_examples/entity_attributes.rb
|
392
|
+
- spec/support/shared_examples/entity_collection.rb
|
356
393
|
- spec/support/shared_examples/http_request_methods.rb
|
357
394
|
- spec/support/vcr.rb
|
358
395
|
homepage: https://github.com/myfreecomm/myfinance-client-ruby
|
@@ -376,7 +413,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
376
413
|
version: '0'
|
377
414
|
requirements: []
|
378
415
|
rubyforge_project:
|
379
|
-
rubygems_version: 2.6.
|
416
|
+
rubygems_version: 2.6.11
|
380
417
|
signing_key:
|
381
418
|
specification_version: 4
|
382
419
|
summary: A Ruby client for the Myfinance REST API
|
@@ -408,6 +445,12 @@ test_files:
|
|
408
445
|
- spec/lib/myfinance/entities/person_spec.rb
|
409
446
|
- spec/lib/myfinance/entities/receivable_account_spec.rb
|
410
447
|
- spec/lib/myfinance/entities/reconcile_collection_spec.rb
|
448
|
+
- spec/lib/myfinance/entities/sale_account_collection_spec.rb
|
449
|
+
- spec/lib/myfinance/entities/sale_account_spec.rb
|
450
|
+
- spec/lib/myfinance/entities/sale_collection_spec.rb
|
451
|
+
- spec/lib/myfinance/entities/sale_rule_collection_spec.rb
|
452
|
+
- spec/lib/myfinance/entities/sale_rule_spec.rb
|
453
|
+
- spec/lib/myfinance/entities/sale_spec.rb
|
411
454
|
- spec/lib/myfinance/entities/tax_collection_spec.rb
|
412
455
|
- spec/lib/myfinance/entities/tax_spec.rb
|
413
456
|
- spec/lib/myfinance/entities/webhook_collection_spec.rb
|
@@ -428,6 +471,10 @@ test_files:
|
|
428
471
|
- spec/lib/myfinance/resources/person_spec.rb
|
429
472
|
- spec/lib/myfinance/resources/receivable_account_spec.rb
|
430
473
|
- spec/lib/myfinance/resources/reconcile_spec.rb
|
474
|
+
- spec/lib/myfinance/resources/sale_account.spec.rb
|
475
|
+
- spec/lib/myfinance/resources/sale_account_spec.rb
|
476
|
+
- spec/lib/myfinance/resources/sale_rule_spec.rb
|
477
|
+
- spec/lib/myfinance/resources/sale_spec.rb
|
431
478
|
- spec/lib/myfinance/resources/tax_spec.rb
|
432
479
|
- spec/lib/myfinance/resources/webhook_spec.rb
|
433
480
|
- spec/lib/myfinance/response_spec.rb
|
@@ -438,5 +485,6 @@ test_files:
|
|
438
485
|
- spec/support/client.rb
|
439
486
|
- spec/support/matchers/have_attr_accessor.rb
|
440
487
|
- spec/support/shared_examples/entity_attributes.rb
|
488
|
+
- spec/support/shared_examples/entity_collection.rb
|
441
489
|
- spec/support/shared_examples/http_request_methods.rb
|
442
490
|
- spec/support/vcr.rb
|