finapps 0.1.15.pre → 0.1.16.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: c24fbc27c58055db47ce5046af1980688218dc4f
4
- data.tar.gz: 31f41a2788b64b15b1375d4ed7a54fc04510c391
3
+ metadata.gz: a818aeff9a31ef6eb1f67d3b1880859d7c43c0b6
4
+ data.tar.gz: 23ccd3acc49ef3db74e2efd5062966bdb1e8a7df
5
5
  SHA512:
6
- metadata.gz: 6f1494b4b39e11f43324f79b53ab55ebc9b3759f9741b2601daa0de379145fa402a99455acc4f6b94d5e00362ef590aff1881a709cb720ebcdc60784dd0252c4
7
- data.tar.gz: 9006b9e0e60fdea3578a4c19daae91d341f562710d52b7af40a196f4ea5c7cb6344fd48245762b753f135864cb3b330913924397ec5c572b6a27cdbd91597961
6
+ metadata.gz: e36fa88c4a4b77425fa524fdfccb7983c3180fc7d1e8b6a3b39afb428afabfcf5a3d0aebfb55e6d706f9b9bc5c67ddb9b1641d57e81baca75e82893d0726d7c2
7
+ data.tar.gz: 2c181db9b899a5150a498f91a50bc506e241b5056d44a69829b918184c676227c6a542b7c218994609c1b44022474a9b2bab8c001e96f7aba9406d6d28db2db6
data/lib/finapps.rb CHANGED
@@ -21,5 +21,7 @@ require 'finapps/rest/users'
21
21
  require 'finapps/rest/institutions'
22
22
  require 'finapps/rest/user_institutions'
23
23
  require 'finapps/rest/accounts'
24
+ require 'finapps/rest/transactions'
25
+
24
26
  require 'finapps/rest/connection'
25
27
  require 'finapps/rest/client'
@@ -18,6 +18,26 @@ module FinApps
18
18
  return accounts, error_messages
19
19
  end
20
20
 
21
+ def show(account_id)
22
+ logger.debug "##{__method__.to_s} => Started"
23
+
24
+ raise MissingArgumentsError.new 'Missing argument: account_id.' if account_id.blank?
25
+ logger.debug "##{__method__.to_s} => site_id: #{site_id}"
26
+
27
+ end_point = Defaults::END_POINTS[:accounts_show]
28
+ logger.debug "##{__method__.to_s} => end_point: #{end_point}"
29
+
30
+ path = end_point.sub ':account_id', ERB::Util.url_encode(account_id)
31
+ logger.debug "##{__method__.to_s} => path: #{path}"
32
+
33
+ account, error_messages = @client.send(path, :get ) do |r|
34
+ Account.new(r.body)
35
+ end
36
+
37
+ logger.debug "##{__method__.to_s} => Completed"
38
+ return account, error_messages
39
+ end
40
+
21
41
  end
22
42
 
23
43
  class Account < FinApps::REST::Resource
@@ -5,7 +5,7 @@ module FinApps
5
5
  include FinApps::Logging
6
6
  include FinApps::REST::Connection
7
7
 
8
- attr_reader :users, :institutions, :user_institutions, :accounts
8
+ attr_reader :users, :institutions, :user_institutions, :accounts, :transactions
9
9
 
10
10
  # @param [String] company_identifier
11
11
  # @param [String] company_token
@@ -169,6 +169,7 @@ module FinApps
169
169
  @institutions ||= FinApps::REST::Institutions.new self
170
170
  @user_institutions ||= FinApps::REST::UserInstitutions.new self
171
171
  @accounts ||= FinApps::REST::Accounts.new self
172
+ @transactions ||= FinApps::REST::Transactions.new self
172
173
  end
173
174
 
174
175
  end
@@ -26,10 +26,18 @@ module FinApps
26
26
  :users_create => 'users/new',
27
27
  :users_login => 'users/login',
28
28
  :users_delete => 'users/:public_id/delete',
29
+
29
30
  :institutions_search => 'institutions/:search_term/search',
30
31
  :institutions_form => 'institutions/:site_id/form',
32
+
31
33
  :user_institutions_add => 'institutions/:site_id/add',
32
- :accounts_list => 'accounts/list'
34
+ :user_institutions_status => 'institutions/user/:user_institution_id/status',
35
+ :user_institutions_refresh_all => 'institutions/user/refresh/all',
36
+
37
+ :accounts_list => 'accounts/list',
38
+ :accounts_show => 'accounts/:account_id/show',
39
+
40
+ :transactions_search => 'transactions/search'
33
41
  }.freeze
34
42
 
35
43
  end
@@ -0,0 +1,33 @@
1
+ module FinApps
2
+ module REST
3
+
4
+ require 'erb'
5
+
6
+ class Transactions < FinApps::REST::Resources
7
+ include FinApps::REST::Defaults
8
+
9
+ # @param [Hash] params
10
+ # @return [Array<FinApps::REST::Transaction>, Array<String>]
11
+ def search(params={})
12
+ logger.debug "##{__method__.to_s} => Started"
13
+
14
+ path = Defaults::END_POINTS[:transactions_search]
15
+ logger.debug "##{__method__.to_s} => path: #{path}"
16
+
17
+ transactions, error_messages = @client.send(path, :post, params) do |r|
18
+ r.body.each { |i| Transaction.new(i) }
19
+ end
20
+
21
+ logger.debug "##{__method__.to_s} => Completed"
22
+ return transactions, error_messages
23
+ end
24
+
25
+ end
26
+
27
+ class Transaction < FinApps::REST::Resource
28
+ attr_accessor :_id, :account_id, :date, :transaction_date, :description, :amount,
29
+ :type, :status, :keyword, :merchant_name, :categories, :tags
30
+ end
31
+
32
+ end
33
+ end
@@ -29,6 +29,37 @@ module FinApps
29
29
  return user_institution, error_messages
30
30
  end
31
31
 
32
+ def status(user_institution_id)
33
+ logger.debug "##{__method__.to_s} => Started"
34
+
35
+ raise MissingArgumentsError.new 'Missing argument: user_institution_id.' if user_institution_id.blank?
36
+ logger.debug "##{__method__.to_s} => user_institution_id: #{user_institution_id}"
37
+
38
+ end_point = Defaults::END_POINTS[:user_institutions_status]
39
+ logger.debug "##{__method__.to_s} => end_point: #{end_point}"
40
+
41
+ path = end_point.sub ':user_institution_id', ERB::Util.url_encode(user_institution_id)
42
+ logger.debug "##{__method__.to_s} => path: #{path}"
43
+
44
+ user_institution, error_messages = @client.send(path, :get ) do |r|
45
+ UserInstitution.new(r.body)
46
+ end
47
+
48
+ logger.debug "##{__method__.to_s} => Completed"
49
+ return user_institution, error_messages
50
+ end
51
+
52
+ def refresh_all
53
+ logger.debug "##{__method__.to_s} => Started"
54
+
55
+ path = Defaults::END_POINTS[:user_institutions_refresh_all]
56
+ logger.debug "##{__method__.to_s} => path: #{path}"
57
+
58
+ _, error_messages = @client.send(path, :get )
59
+
60
+ logger.debug "##{__method__.to_s} => Completed"
61
+ error_messages
62
+ end
32
63
  end
33
64
 
34
65
  class UserInstitution < FinApps::REST::Resource
@@ -1,3 +1,3 @@
1
1
  module FinApps
2
- VERSION = '0.1.15.pre'
2
+ VERSION = '0.1.16.pre'
3
3
  end
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: 0.1.15.pre
4
+ version: 0.1.16.pre
5
5
  platform: ruby
6
6
  authors:
7
7
  - Erich Quintero
@@ -205,6 +205,7 @@ files:
205
205
  - lib/finapps/rest/institutions.rb
206
206
  - lib/finapps/rest/resource.rb
207
207
  - lib/finapps/rest/resources.rb
208
+ - lib/finapps/rest/transactions.rb
208
209
  - lib/finapps/rest/user_institutions.rb
209
210
  - lib/finapps/rest/users.rb
210
211
  - lib/finapps/utils/logging.rb