finapps 0.1.23.pre → 0.2.1.pre

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: a3178b4fe0c82486ac920e33008b09bcb5ffc60c
4
- data.tar.gz: ef78b0ae54d031a3cb4863bb886be11cd0e10360
3
+ metadata.gz: 40f4915c09e5c1d6230d82c5d763c05e56d349e4
4
+ data.tar.gz: 32290bccbb18c1cae70d3db2e15cd4b38dc59600
5
5
  SHA512:
6
- metadata.gz: df9fb0a8282ed46cab7ec47630970807984a48c0b8db2bad0dd22b357aff04f268621f6038923b66a367c421a06c78e3f0c8be50eb7030187e398769a55fa127
7
- data.tar.gz: 7030013525807af229640a9e68bea4efc091d0d4fdd7c2c0d42ef159a26f1127628ae76d98fccafc42b03d9c04695d826c841ed98f5ecf4ff08daa8a23a3424e
6
+ metadata.gz: 4f988b6c5785c94811cca63cbcf06deacd79b814eaae90c68502647d5aa97728f8883baa4d83a2931e9a77d00524148cf9c6e45cb47926205cf263cf1e7c4ab4
7
+ data.tar.gz: 1b3f8d658bb9a8fb1206e93d0c1e372c60188db1e52fea9a0addf62b010b64366cac5e3e6217652250b0f682f28a37d4f7fbf65875246116564fa2e8bcd59845
@@ -4,20 +4,6 @@ module FinApps
4
4
  class Accounts < FinApps::REST::Resources
5
5
  include FinApps::REST::Defaults
6
6
 
7
- def list
8
- logger.debug "##{__method__.to_s} => Started"
9
-
10
- path = Defaults::END_POINTS[:accounts_list]
11
- logger.debug "##{__method__.to_s} => path: #{path}"
12
-
13
- accounts, error_messages = @client.send(path, :get) do |r|
14
- r.body.each { |i| Account.new(i) }
15
- end
16
-
17
- logger.debug "##{__method__.to_s} => Completed"
18
- return accounts, error_messages
19
- end
20
-
21
7
  def show(account_id)
22
8
  logger.debug "##{__method__.to_s} => Started"
23
9
 
@@ -41,8 +27,7 @@ module FinApps
41
27
  end
42
28
 
43
29
  class Account < FinApps::REST::Resource
44
- attr_accessor :_id, :user_institution_id, :user_institution_name, :account_id, :account_type,
45
- :account_name, :account_holder, :account_display_name, :details
30
+ attr_accessor :_id, :account_type, :account_name, :account_holder, :account_display_name, :details
46
31
 
47
32
  def initialize(hash)
48
33
  super
@@ -30,11 +30,12 @@ module FinApps
30
30
  :institutions_search => 'institutions/:search_term/search',
31
31
  :institutions_form => 'institutions/:site_id/form',
32
32
 
33
+ :user_institutions_list => 'institutions/user',
33
34
  :user_institutions_add => 'institutions/:site_id/add',
35
+ :user_institutions_show => 'institutions/user/:user_institution_id',
34
36
  :user_institutions_status => 'institutions/user/:user_institution_id/status',
35
- :user_institutions_refresh_all => 'institutions/user/refresh/all',
37
+ :user_institutions_refresh => 'institutions/user/refresh',
36
38
 
37
- :accounts_list => 'accounts/list',
38
39
  :accounts_show => 'accounts/:account_id/show',
39
40
 
40
41
  :transactions_search => 'transactions/search'
@@ -6,6 +6,20 @@ module FinApps
6
6
  class UserInstitutions < FinApps::REST::Resources
7
7
  include FinApps::REST::Defaults
8
8
 
9
+ def list
10
+ logger.debug "##{__method__.to_s} => Started"
11
+
12
+ path = Defaults::END_POINTS[:user_institutions_list]
13
+ logger.debug "##{__method__.to_s} => path: #{path}"
14
+
15
+ user_institutions, error_messages = @client.send(path, :get) do |r|
16
+ r.body.each { |i| UserInstitution.new(i) }
17
+ end
18
+
19
+ logger.debug "##{__method__.to_s} => Completed"
20
+ return user_institutions, error_messages
21
+ end
22
+
9
23
  def add(site_id, parameters)
10
24
  logger.debug "##{__method__.to_s} => Started"
11
25
 
@@ -21,7 +35,27 @@ module FinApps
21
35
  path = end_point.sub ':site_id', ERB::Util.url_encode(site_id)
22
36
  logger.debug "##{__method__.to_s} => path: #{path}"
23
37
 
24
- user_institution, error_messages = @client.send(path, :post, :parameters => parameters ) do |r|
38
+ user_institution, error_messages = @client.send(path, :post, :parameters => parameters) do |r|
39
+ UserInstitution.new(r.body)
40
+ end
41
+
42
+ logger.debug "##{__method__.to_s} => Completed"
43
+ return user_institution, error_messages
44
+ end
45
+
46
+ def show(user_institution_id)
47
+ logger.debug "##{__method__.to_s} => Started"
48
+
49
+ raise MissingArgumentsError.new 'Missing argument: user_institution_id.' if user_institution_id.blank?
50
+ logger.debug "##{__method__.to_s} => user_institution_id: #{user_institution_id}"
51
+
52
+ end_point = Defaults::END_POINTS[:user_institutions_show]
53
+ logger.debug "##{__method__.to_s} => end_point: #{end_point}"
54
+
55
+ path = end_point.sub ':user_institution_id', ERB::Util.url_encode(user_institution_id)
56
+ logger.debug "##{__method__.to_s} => path: #{path}"
57
+
58
+ user_institution, error_messages = @client.send(path, :get) do |r|
25
59
  UserInstitution.new(r.body)
26
60
  end
27
61
 
@@ -41,7 +75,7 @@ module FinApps
41
75
  path = end_point.sub ':user_institution_id', ERB::Util.url_encode(user_institution_id)
42
76
  logger.debug "##{__method__.to_s} => path: #{path}"
43
77
 
44
- user_institution, error_messages = @client.send(path, :get ) do |r|
78
+ user_institution, error_messages = @client.send(path, :get) do |r|
45
79
  UserInstitution.new(r.body)
46
80
  end
47
81
 
@@ -49,13 +83,13 @@ module FinApps
49
83
  return user_institution, error_messages
50
84
  end
51
85
 
52
- def refresh_all
86
+ def refresh
53
87
  logger.debug "##{__method__.to_s} => Started"
54
88
 
55
- path = Defaults::END_POINTS[:user_institutions_refresh_all]
89
+ path = Defaults::END_POINTS[:user_institutions_refresh]
56
90
  logger.debug "##{__method__.to_s} => path: #{path}"
57
91
 
58
- _, error_messages = @client.send(path, :get )
92
+ _, error_messages = @client.send(path, :get)
59
93
 
60
94
  logger.debug "##{__method__.to_s} => Completed"
61
95
  error_messages
@@ -63,7 +97,13 @@ module FinApps
63
97
  end
64
98
 
65
99
  class UserInstitution < FinApps::REST::Resource
66
- attr_accessor :_id, :account_id, :user_public_id, :institution_name, :status, :status_message, :last_refreshed
100
+ attr_accessor :_id, :account_id, :institution_name, :status, :status_message, :last_refreshed, :accounts
101
+
102
+ def initialize(hash)
103
+ super
104
+ @accounts ||= []
105
+ hash[:accounts].each { |a| @accounts << FinApps::REST::Account.new(a) } if hash[:accounts].respond_to?(:each)
106
+ end
67
107
  end
68
108
 
69
109
  end
@@ -1,3 +1,3 @@
1
1
  module FinApps
2
- VERSION = '0.1.23.pre'
2
+ VERSION = '0.2.1.pre'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: finapps
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.23.pre
4
+ version: 0.2.1.pre
5
5
  platform: ruby
6
6
  authors:
7
7
  - Erich Quintero
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-08-06 00:00:00.000000000 Z
11
+ date: 2014-08-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor