myfinance 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fd16eafab7c1a94cdb638ad2e9efa9c942029289
4
- data.tar.gz: b71308b1b0e4cd9629698d185cbd9ae7a70d242d
3
+ metadata.gz: e49d84feaf307f282f994b21f56cc226f43d8079
4
+ data.tar.gz: d2fcb49e144edf03733dfb3859b86e756d1534fa
5
5
  SHA512:
6
- metadata.gz: c186bac4b437d5a1ace502f62985389aa0637cf9614886bc7805e5d6fc619f979e7c41e5810a63d2d113bb240b2ca3d2a88f4310aad64dd4a8b588ad882be856
7
- data.tar.gz: 9eba0d8098e7be11dd9e2694d2f2e32a2c626987885437f41fdaad42b016d43bb4a4aa1a463f38fa3f856f471ac57d3106b163b35fede4d60d1a5261acfa140c
6
+ metadata.gz: 9baa5c658a1a964658141f2f4fcdbb69c82c404134162aaca037e423ef52df92d5369663f5af385378cf2ca766941d5a05f810b8b989c81f883cb70c64306c2f
7
+ data.tar.gz: b470d45735a4139faa9f98839e023984d69b25b1434604153d85bead8a26db9e61cb0a47dbde84871160fd809c76c15984935f2080fb8850da3783c946e00aff
data/.gitignore CHANGED
@@ -6,7 +6,7 @@
6
6
  .DS_Store
7
7
  .envrc
8
8
  .env
9
- .ruby-version
9
+ .ruby-*
10
10
  .rvmrc
11
11
  coverage
12
12
  InstalledFiles
@@ -2,28 +2,28 @@
2
2
 
3
3
  ## v1.2.0
4
4
  ### Endpoints improvements
5
- - The `#find_all` method of all endpoints that support filtering can now receive parameters to refine the results and paginate
5
+ - The `#find_all` method of all endpoints that support filtering can now receive parameters to refine the results and paginate.
6
6
  ### Deprecations
7
7
  - No longer supports `#find_by`. Use `#find_all` instead, passing filters as a hash if needed.
8
8
  ### Fixes
9
- - Params encoding set to Rack
9
+ - Params encoding set to Rack. This is necessary in order to fix an issue with Array parameters.
10
10
 
11
11
  ## v1.1.0
12
12
 
13
13
  ### New Endpoints
14
- - Add endpoint Deposit Accounts filtering
15
- - Add endpoint Entities filtering
14
+ - Add endpoint Deposit Accounts filtering.
15
+ - Add endpoint Entities filtering.
16
16
 
17
17
  ## v1.0.0
18
18
 
19
19
  ### New Endpoints
20
- - Add Bank Statements endpoints
21
- - Add Categories endpoints
22
- - Add Credit Cards endpoints
23
- - Add Credit Cards Transactions endpoints
24
- - Add Reconciles endpoints
25
- - More endpoints for Financial Accounts (`find_all`, `find`)
20
+ - Add Bank Statements endpoints.
21
+ - Add Categories endpoints.
22
+ - Add Credit Cards endpoints.
23
+ - Add Credit Cards Transactions endpoints.
24
+ - Add Reconciles endpoints.
25
+ - More endpoints for Financial Accounts (`find_all`, `find`).
26
26
  ### Improvements
27
- - Implement search by attributes in Categories
27
+ - Implement search by attributes in Categories.
28
28
  ### Deprecations
29
- - `FinancialAccount#destroy` and `#update` signatures are now `(entity_id, id, params)` instead of `(id, entity_id, params)`
29
+ - `FinancialAccount#destroy` and `#update` signatures are now `(entity_id, id, params)` instead of `(id, entity_id, params)`.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- myfinance (1.2.0)
4
+ myfinance (1.2.1)
5
5
  mime-types (~> 2.99)
6
6
  multi_json (~> 1.11)
7
7
  typhoeus (~> 0.8)
@@ -16,7 +16,7 @@ module Myfinance
16
16
  end
17
17
 
18
18
  def query(params)
19
- page = params.delete(:page)
19
+ page = params.delete(:page)
20
20
  query = params.map { |key, value| "search[#{key}]=#{value}" }
21
21
  query << "page=#{page}" if page
22
22
  query
@@ -88,6 +88,20 @@ module Myfinance
88
88
  def endpoint
89
89
  "/classification_centers"
90
90
  end
91
+
92
+ def build_search_endpoint(params)
93
+ query_string = query(params).join("&")
94
+ URI.encode("#{endpoint}?#{query_string}")
95
+ end
96
+
97
+ def query(params)
98
+ page = params.delete(:page)
99
+ per_page = params.delete(:per_page)
100
+ query = params.map { |key, value| "search[#{key}]=#{value}" }
101
+ query << "page=#{page}" if page
102
+ query << "per_page=#{per_page}" if per_page
103
+ query
104
+ end
91
105
  end
92
106
  end
93
107
  end
@@ -1,3 +1,3 @@
1
1
  module Myfinance
2
- VERSION = "1.2.0"
2
+ VERSION = "1.2.1"
3
3
  end
@@ -57,6 +57,16 @@ describe Myfinance::Resources::ClassificationCenter, vcr: true do
57
57
  expect(url).to include("page=#{page}")
58
58
  end
59
59
  end
60
+
61
+ context "when per page" do
62
+ let(:search_params) { { per_page: 400, page: page, entity_id_equals: 3798, name_contains: "Centro" } }
63
+ subject { client.classification_centers.find_all(search_params) }
64
+
65
+ it "returns url" do
66
+ url = subject.response.request.base_url
67
+ expect(url).to include("per_page=#{400}")
68
+ end
69
+ end
60
70
  end
61
71
 
62
72
  context "when error" do
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.2.0
4
+ version: 1.2.1
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-03-28 00:00:00.000000000 Z
14
+ date: 2017-04-12 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: typhoeus
@@ -376,7 +376,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
376
376
  version: '0'
377
377
  requirements: []
378
378
  rubyforge_project:
379
- rubygems_version: 2.6.8
379
+ rubygems_version: 2.6.10
380
380
  signing_key:
381
381
  specification_version: 4
382
382
  summary: A Ruby client for the Myfinance REST API