finapps 2.2.5 → 2.2.6

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: f93286a09de0aef183aaa9de0e098e0b0748a8f6
4
- data.tar.gz: 52b7526d608956c8e4740446929f45b01beb9985
3
+ metadata.gz: 5eea1024ec978abcab4190e471f049c2ffa58464
4
+ data.tar.gz: d2d6032dfbd8616f0b68e279572da536550bd09d
5
5
  SHA512:
6
- metadata.gz: e0fc54810448b27dadaac4c0bcb96e7efe4b29b3edb025a2c7f4e59f19a6b5e0be82087728fe113bc2e0ee3403c7a00c84792e6363ec30fd9eb559f0f7409892
7
- data.tar.gz: 6a8399c02192fc9531cebb39ddfc22a4e32d70092af6664a7670dd5055471c6dd28705e77a6750642349260c4fffc3663005ced0aea01ee5d760586cb049941d
6
+ metadata.gz: 9411cc800f1ba4e7ac2032ac24928c6f828be674195330573cc36c46e98b7be155d9e69418d0cf6ebd68059ecd75a5e61d5b756484656f70cdce8785da8cf9cb
7
+ data.tar.gz: 0f54d4ffbf29334e37bd5e17e27efc25e567a1bf4b449b9703ea6269453084d7d00993a1e9d73dc35ed5d0133fd0fb04e4810bd96d7447d4e1b8a71f973a7bc8
@@ -23,11 +23,12 @@ module FinApps
23
23
  # date - the date of the order
24
24
  # status - the status of the order
25
25
  # :asc - sort order true for asc false for desc
26
- def list(params=nil) # params hash with optional keys [:page, :requested, :sort, :asc]
27
- return super 'list/orders/1/10000/date/false' if params.nil?
28
- raise FinAppsCore::InvalidArgumentsError.new 'Invalid argument: params' unless params.is_a? Hash
29
-
30
- super build_path(params)
26
+ def list # (params=nil) # params hash with optional keys [:page, :requested, :sort, :asc]
27
+ super 'orders?page=1&requested=500&sort=-date'
28
+ # TODO: change to support https://github.com/finapps/api/blob/develop/misc/docs/iav.md#get-list-of-orders
29
+ # return super 'orders?page=1&requested=500&sort=-date' # if params.nil?
30
+ # raise FinAppsCore::InvalidArgumentsError.new 'Invalid argument: params' unless params.is_a? Hash
31
+ # super build_path(params)
31
32
  end
32
33
 
33
34
  def update(id, params)
@@ -42,18 +43,20 @@ module FinApps
42
43
  super params, path
43
44
  end
44
45
 
45
- private
46
-
47
- def build_path(p)
48
- page = p[:page] || 1
49
- requested = p[:requested] || 100
50
- sort = p[:sort] || 'date'
51
- asc = p[:asc] || false
52
- end_point = 'list/orders'
53
- path = end_point.dup
54
- [page, requested, sort, asc].each_with_index {|a| path << "/#{ERB::Util.url_encode(a)}" }
55
- path
56
- end
46
+ # private
47
+ #
48
+ # def build_path(p)
49
+ # # TODO: change to support https://github.com/finapps/api/blob/develop/misc/docs/iav.md#get-list-of-orders
50
+ #
51
+ # page = p[:page] || 1
52
+ # requested = p[:requested] || 100
53
+ # sort = p[:sort] || 'date'
54
+ # asc = p[:asc]
55
+ # end_point = 'orders'
56
+ # path = end_point.dup
57
+ # [page, requested, sort, asc].each_with_index {|a| path << "/#{ERB::Util.url_encode(a)}" }
58
+ # path
59
+ # end
57
60
  end
58
61
  end
59
62
  end
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module FinApps
3
- VERSION = '2.2.5'
3
+ VERSION = '2.2.6'
4
4
  end
@@ -4,7 +4,7 @@ RSpec.describe FinApps::REST::OrderStatuses do
4
4
 
5
5
  RESULTS = 0
6
6
  ERROR_MESSAGES = 1
7
-
7
+
8
8
  describe '#show' do
9
9
  context 'when missing id' do
10
10
  subject { FinApps::REST::OrderStatuses.new(client).show(nil) }
@@ -24,7 +24,9 @@ RSpec.describe FinApps::REST::OrderStatuses do
24
24
 
25
25
  it { expect { subject }.not_to raise_error }
26
26
  it('results is nil') { expect(subject[RESULTS]).to be_nil }
27
- it('error messages array is populated') { expect(subject[ERROR_MESSAGES].first.downcase).to eq('resource not found') }
27
+ it('error messages array is populated') do
28
+ expect(subject[ERROR_MESSAGES].first.downcase).to eq('resource not found')
29
+ end
28
30
  end
29
31
  end
30
32
  end
@@ -4,7 +4,7 @@ RSpec.describe FinApps::REST::OrderTokens, 'initialized with valid FinApps::Clie
4
4
 
5
5
  RESULTS = 0
6
6
  ERROR_MESSAGES = 1
7
-
7
+
8
8
  describe '#show' do
9
9
  subject(:order_tokens) { FinApps::REST::OrderTokens.new(client) }
10
10
  let(:results) { show[RESULTS] }
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
  RSpec.describe FinApps::REST::Orders do
3
3
  include SpecHelpers::Client
4
-
4
+
5
5
  RESULTS = 0
6
6
  ERROR_MESSAGES = 1
7
7
 
@@ -49,7 +49,9 @@ RSpec.describe FinApps::REST::Orders do
49
49
 
50
50
  it { expect { subject }.not_to raise_error }
51
51
  it('results is nil') { expect(subject[RESULTS]).to be_nil }
52
- it('error messages array is populated') { expect(subject[ERROR_MESSAGES].first.downcase).to eq('invalid request body') }
52
+ it('error messages array is populated') do
53
+ expect(subject[ERROR_MESSAGES].first.downcase).to eq('invalid request body')
54
+ end
53
55
  end
54
56
  end
55
57
 
@@ -57,7 +59,7 @@ RSpec.describe FinApps::REST::Orders do
57
59
  context 'when missing params' do
58
60
  # use defaults
59
61
 
60
- subject { FinApps::REST::Orders.new(client).list(nil) }
62
+ subject { FinApps::REST::Orders.new(client).list }
61
63
  it { expect { subject }.not_to raise_error }
62
64
 
63
65
  it('returns an array') { expect(subject).to be_a(Array) }
@@ -65,16 +67,16 @@ RSpec.describe FinApps::REST::Orders do
65
67
  it('returns no error messages') { expect(subject[ERROR_MESSAGES]).to be_empty }
66
68
  end
67
69
 
68
- context 'when including partial params' do
69
- subject { FinApps::REST::Orders.new(client).list(params) }
70
- let(:params) { {page: 2, sort: 'status'} }
71
-
72
- it { expect { subject }.not_to raise_error }
73
- it('returns an array') { expect(subject).to be_a(Array) }
74
- it('performs a get and returns the response') { expect(subject[RESULTS]).to respond_to(:orders) }
75
- it('each order contains a consumer_id') { expect(subject[RESULTS].orders).to all(respond_to(:consumer_id)) }
76
- it('returns no error messages') { expect(subject[ERROR_MESSAGES]).to be_empty }
77
- end
70
+ # context 'when including partial params' do
71
+ # subject { FinApps::REST::Orders.new(client).list(params) }
72
+ # let(:params) { {page: 2, sort: 'status'} }
73
+ #
74
+ # it { expect { subject }.not_to raise_error }
75
+ # it('returns an array') { expect(subject).to be_a(Array) }
76
+ # it('performs a get and returns the response') { expect(subject[RESULTS]).to respond_to(:orders) }
77
+ # it('each order contains a consumer_id') { expect(subject[RESULTS].orders).to all(respond_to(:consumer_id)) }
78
+ # it('returns no error messages') { expect(subject[ERROR_MESSAGES]).to be_empty }
79
+ # end
78
80
  end
79
81
 
80
82
  describe '#update' do
@@ -26,7 +26,9 @@ RSpec.describe FinApps::REST::UserInstitutionsForms do
26
26
 
27
27
  it { expect { subject }.not_to raise_error }
28
28
  it('results is nil') { expect(subject[RESULT]).to be_nil }
29
- it('error messages array is populated') { expect(subject[ERROR_MESSAGES].first.downcase).to eq('invalid institution id') }
29
+ it('error messages array is populated') do
30
+ expect(subject[ERROR_MESSAGES].first.downcase).to eq('invalid institution id')
31
+ end
30
32
  end
31
33
  end
32
34
  end
@@ -27,7 +27,9 @@ RSpec.describe FinApps::REST::UserInstitutionsStatuses do
27
27
 
28
28
  it { expect { subject }.not_to raise_error }
29
29
  it('results is nil') { expect(subject[RESULT]).to be_nil }
30
- it('error messages array is populated') { expect(subject[ERROR_MESSAGES].first.downcase).to eq('invalid user institution id') }
30
+ it('error messages array is populated') do
31
+ expect(subject[ERROR_MESSAGES].first.downcase).to eq('invalid user institution id')
32
+ end
31
33
  end
32
34
  end
33
35
 
@@ -17,7 +17,7 @@ class FakeApi < Sinatra::Base
17
17
  post('/v2/orders/valid_token') { json_response 200, 'order_token.json' }
18
18
  post('/v2/orders/invalid_token') { json_response 404, 'resource_not_found.json' }
19
19
  get('/v2/orders/valid_id') { json_response 200, 'order.json' }
20
- get('/v2/list/orders/:page/:requested/:sort/:asc') { json_response 200, 'orders.json' }
20
+ get('/v2/orders') { json_response 200, 'orders.json' }
21
21
  get('/v2/orders/valid_id/report.:format') { json_response 200, 'order_report.json' }
22
22
  get('/v2/orders/invalid_id/report.:format') { json_response 404, 'resource_not_found.json' }
23
23
  get('/v2/orders/valid_id/status') { json_response 200, 'order_status.json' }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: finapps
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.5
4
+ version: 2.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Erich Quintero