coyodlee 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +10 -1
- data/Gemfile +1 -0
- data/README.md +29 -30
- data/coyodlee.gemspec +5 -1
- data/examples/demo.rb +23 -0
- data/lib/coyodlee.rb +6 -5
- data/lib/coyodlee/connection.rb +207 -0
- data/lib/coyodlee/facades.rb +6 -0
- data/lib/coyodlee/facades/accounts_facade.rb +52 -0
- data/lib/coyodlee/facades/cobrand_facade.rb +32 -0
- data/lib/coyodlee/facades/holdings_facade.rb +33 -0
- data/lib/coyodlee/facades/provider_accounts_facade.rb +52 -0
- data/lib/coyodlee/facades/transactions_facade.rb +88 -0
- data/lib/coyodlee/facades/user_facade.rb +39 -0
- data/lib/coyodlee/session.rb +46 -0
- data/lib/coyodlee/session_authorization.rb +25 -0
- data/lib/coyodlee/session_tokens.rb +39 -0
- data/lib/coyodlee/uri_builder.rb +26 -0
- data/lib/coyodlee/version.rb +1 -1
- metadata +75 -12
- data/lib/coyodlee/client.rb +0 -550
- data/lib/coyodlee/http_wrapper.rb +0 -27
- data/lib/coyodlee/sessions.rb +0 -2
- data/lib/coyodlee/sessions/cobrand_session.rb +0 -50
- data/lib/coyodlee/sessions/user_session.rb +0 -60
- data/lib/coyodlee/utils.rb +0 -26
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 40db7ffc3fa44618447c72116d9cd62c954a4f02541784ada16d4d29f5104d14
|
4
|
+
data.tar.gz: 2f2915b89732be626884d3b6eec01edb867f5f7899b2524faec8183ddd71cfdf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a950639030248a83ed8277763b6f2c4f91fccfd6bd350e692eb3ecbcca5395a558feca0153d6d86dd10aaeb04d783668fb47b174b07eb3cf84d1c4abea4edcf9
|
7
|
+
data.tar.gz: ee77c734c28abf4b844ad6ab3f2c95f51b754a627a5251ea54e6fbe0e6075e29ea939ab7d92a5444c3268800bdb8fc38822338aee1a2e60f6d2611a82e295ae5
|
data/.travis.yml
CHANGED
@@ -1,9 +1,18 @@
|
|
1
1
|
language: ruby
|
2
2
|
rvm:
|
3
|
-
- 2.
|
3
|
+
- 2.3
|
4
|
+
- 2.4
|
5
|
+
- 2.5
|
6
|
+
before_script:
|
7
|
+
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
|
8
|
+
- chmod +x ./cc-test-reporter
|
9
|
+
- ./cc-test-reporter before-build
|
4
10
|
before_install: gem install bundler -v 1.11.2
|
11
|
+
after_script:
|
12
|
+
- ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
|
5
13
|
env:
|
6
14
|
global:
|
15
|
+
- CC_TEST_REPORTER_ID: 97fb3bdc3bc9764c19651246fad6c2a798a83d410f1eab0a66e467e9c2b2ce79
|
7
16
|
- secure: uUfBk39flmbyd21ayyqVP4pm1FS7h18joIIAF+547CV6+6Ke7BG3DxR+ivIDG1MVXZNErQ+U5zRAcnG0kWYwbJ1bcFksJYpxR6hN+6MY6SDW7G2oN/Ono6DqHE/tnzrL+/Ax5ui0Yw/W6258tlgm1dj3K28/lmmoK1qbyNqeL5bf+PoggNSIk/DQIHotJsWR4QEIXQM077+PGRfm9TIBE9hU77Cphmu0jPk9NTUHdQHGo6SwDfl2X5CO1Qfp43cn0X7Giir3+tHWZZo8bdDmhDKiTVrLpCFvD6tXHzvU5zhyElUAM4jdPH+jXpmLSK+OwEJispCxHgt6Zd9RELEYMRidlInuxrqYrwikc55shuiIHRq7Sf0JmB2q+sj70+1bNSrJlfPZ6GK3+Ye+HIEGTf8K4B6PUZDrEsPb4fJiaq1kjB5Z5+s3olVqnl0oVIVWk6Pw6qhn0UgVwFMP26eIua7lGo1g9+DqhtZ9WFhBcLDe5f10M7YfaXgDhIW0yXz7Emqip+llpMg//5R2sSQy48M6jjMX4wDcXVrnYFSZAtUno6unxddctdqXQHDpwr60uEyeyb3j5xJp7LUKs7CkOGrfyPqmljD83Ibayh/yBXelme2l6esElWOUVUScuBint5AiPDrnhbApdUGTYbGDPzB4Et3wwfd4ddePTh8z16M=
|
8
17
|
- secure: t/ro3jAcnKuJCXqzvbxrukbcwD02+CZIUS6tUXBWexxowbvpC+el60ZLP+q9VD40hBy8SwFf7ukdmtunNRXBUmhPb/NhyBRmtcaHlrvReYV1d8AJX/tGtcuv4OirfcXj45u0mEOtUdDTYYvbbv3cecoKPLtjaZcLct2mwoTh0tcTei0qs/4fZNOm5yGrIVIO5lxyrnGTmWKbSceK9FAwz7FiZ108DrG8QApQNmpXS/5P6G4cnpsilRDXt0p4zMdi/QOgPw7dfANU5K1Hwg7cryBsqk4JwN0mJ6AWTkv4A8THuVAmDzojyqH0Su151HecNu5GOfsXiHzavkvQTdO+s00AkqkyZkzCq8KDx8DxeK363iw/gSVztWv3Q77oDhZ6UyOkPgpzYPbMrl9d2+Z/fC2CrSiVKCLnqjdSbSdhOEFgmc3LTSM7kuGEwtwMGPARmjrC7NVynol4Ji6YWAopO/B79dNNBUSAZRt8yJReN26sIZ3bTqqqIhqzZWvPWWRtYkS7TMu3djqb0ey/0rPI35i7esiIrD26XT+invuehZhRJ+qOikscVjwKSw5wVGoWODOELcL9lF5zccQQDp8xtPvQN8818wekGbBibnrnQ98kzVpR7C1Dl0tEM+ZcdfReC/6a5xL8x1/pS+lGvxN5xqMQFbejc6rKTWJjplUkPY4=
|
9
18
|
- secure: emoFvYI3rOkbj8YOOgmLkT7WQtSn/f/D5JTPZ1nl41P8/xaQLGFaa9aSYV3AqsZOER+hDEplek1DFPZNBvgTUND09hpS6qDa9oMGxzJlMxokZIMdHfFBMsb9eXdsvHnG6vilejQ7ic9EfISv4SqwoZmr6KMGBX5o17REtTHwgzuV/aMozhJi5agjWUuLhGFPPTg/fhqLqBZOXCiQjkdhtDkC4PX8FNnwzXWnjn/CuyTZvhapFOftfh76n72FLhMfCpOi3FZnkFcpSvs38uFv7RS9d0ci0XuNFzrhaUbr8WsB+nz1rGKdRUP9RhaU2OJPWmGcGfBeYApG8DhE6dMUJK3k+1X4aPkDjEYm+/xWTjD/2jbRjqvLJJ4B9S75GRz6O3zV4KMc9GkgQWXx+MzCkkc72TsL3XjSCxeqQMvQ8mjl7GFgfeZw5UFiMaCcQzDHECphBAt990rGhwXq0B2eEluOtHo2Kkh7FGvPkCOiMjTdlgNpe2BAh+sf+Bn+/rZ25iFIAWF8IDlfPJc+QiHLtZntwI0afzjWs+2TjDFj3PQ+Shx/Pshk8PXdaPUEP0t7HyLpiWOuyeJaG8O96W/cX51fopmDhlRaVREcpAaJwZ9AXoYSHGXFL9+027L3obG4PYyBF1goBcoe1BZKsLRjGxSftKPmXgCQnBQR3FPYgtM=
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,16 @@
|
|
1
1
|
# Coyodlee
|
2
|
-
[![
|
2
|
+
[![Gem Version](https://badge.fury.io/rb/coyodlee.svg)](https://badge.fury.io/rb/coyodlee)
|
3
|
+
[![Build Status](https://travis-ci.org/pennymac/coyodlee.svg?branch=master)](https://travis-ci.org/pennymac/coyodlee)
|
3
4
|
[![Maintainability](https://api.codeclimate.com/v1/badges/f36b069069540b196fbd/maintainability)](https://codeclimate.com/github/pennymac/coyodlee/maintainability)
|
5
|
+
[![Test Coverage](https://api.codeclimate.com/v1/badges/f36b069069540b196fbd/test_coverage)](https://codeclimate.com/github/pennymac/coyodlee/test_coverage)
|
6
|
+
|
7
|
+
## Status
|
8
|
+
|
9
|
+
The software in this repository is in an early alpha state. This repository is currently not accepting pull requests or responding to issues. If there is a bug in the code or a feature you'd like to have, feel free to fork the repository.
|
10
|
+
|
11
|
+
## Requirements
|
12
|
+
|
13
|
+
This library works with Ruby 2.3+.
|
4
14
|
|
5
15
|
## Setup
|
6
16
|
|
@@ -8,20 +18,10 @@ In sandbox mode, point the ```base_url``` to ```https://developer.api.yodlee.com
|
|
8
18
|
|
9
19
|
Export the following environment variables:
|
10
20
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
</tr>
|
16
|
-
<tr>
|
17
|
-
<td>YODLEE_COBRAND_LOGIN</td>
|
18
|
-
<td>The Yodlee cobrand login</td>
|
19
|
-
<tr/>
|
20
|
-
<tr>
|
21
|
-
<td>YODLEE_COBRAND_PASSWORD</td>
|
22
|
-
<td>The Yodlee cobrand password</td>
|
23
|
-
<tr/>
|
24
|
-
</table>
|
21
|
+
| Environment Variable | Description |
|
22
|
+
|---------------------------|---------------------------------------|
|
23
|
+
| YODLEE\_COBRAND\_LOGIN | The login of your assigned cobrand |
|
24
|
+
| YODLEE\_COBRAND\_PASSWORD | The password of your assigned cobrand |
|
25
25
|
|
26
26
|
## Installation
|
27
27
|
|
@@ -41,34 +41,33 @@ Or install it yourself as:
|
|
41
41
|
|
42
42
|
## Usage
|
43
43
|
|
44
|
-
|
44
|
+
The API remains in flux. Here is the current way to interact with Yodlee:
|
45
45
|
|
46
46
|
``` ruby
|
47
47
|
require 'coyodlee'
|
48
48
|
|
49
49
|
Coyodlee.setup do |config|
|
50
|
-
config.
|
50
|
+
config.host = 'developer.api.yodlee.com'
|
51
51
|
config.cobrand_login = ENV['YODLEE_COBRAND_LOGIN']
|
52
52
|
config.cobrand_password = ENV['YODLEE_COBRAND_PASSWORD']
|
53
53
|
end
|
54
54
|
|
55
|
-
require 'coyodlee/
|
55
|
+
require 'coyodlee/connection'
|
56
|
+
require 'coyodlee/session'
|
56
57
|
|
57
|
-
|
58
|
-
cob_session.login login_name: Coyodlee.cobrand_login, password: Coyodlee.cobrand_password
|
58
|
+
conn = Coyodlee::Connection.create
|
59
59
|
|
60
|
-
|
61
|
-
|
60
|
+
resp = conn.start do |api|
|
61
|
+
session = Coyodlee::Session.create(api)
|
62
|
+
session.cobrand_login login_name: Coyodlee.cobrand_login,
|
63
|
+
password: Coyodlee.cobrand_password
|
64
|
+
session.user_login login_name: ENV['YODLEE_USER_1_LOGIN_NAME'],
|
65
|
+
password: ENV['YODLEE_USER_1_PASSWORD']
|
62
66
|
|
63
|
-
|
64
|
-
|
65
|
-
client = Coyodlee::Client.new(user_session)
|
66
|
-
resp = client.get_accounts
|
67
|
-
|
68
|
-
require 'json'
|
67
|
+
api.get_accounts
|
68
|
+
end
|
69
69
|
|
70
|
-
|
71
|
-
puts JSON.parse(resp.body)
|
70
|
+
puts resp
|
72
71
|
```
|
73
72
|
|
74
73
|
## Testing
|
data/coyodlee.gemspec
CHANGED
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
|
|
19
19
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
20
20
|
spec.require_paths = ["lib"]
|
21
21
|
|
22
|
-
spec.add_dependency "
|
22
|
+
spec.add_dependency "yajl-ruby", "~> 1.3.1"
|
23
23
|
|
24
24
|
spec.add_development_dependency "bundler", "~> 1.11"
|
25
25
|
spec.add_development_dependency "rake", "~> 10.0"
|
@@ -29,4 +29,8 @@ Gem::Specification.new do |spec|
|
|
29
29
|
spec.add_development_dependency "yard", '~> 0.9'
|
30
30
|
spec.add_development_dependency "activesupport", '5.1'
|
31
31
|
spec.add_development_dependency "travis", '~> 1.8'
|
32
|
+
spec.add_development_dependency 'dotenv'
|
33
|
+
spec.add_development_dependency 'pry-byebug'
|
34
|
+
spec.add_development_dependency 'byebug'
|
35
|
+
spec.add_development_dependency 'pry'
|
32
36
|
end
|
data/examples/demo.rb
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'coyodlee'
|
2
|
+
require 'coyodlee/connection'
|
3
|
+
require 'coyodlee/session'
|
4
|
+
require 'dotenv/load'
|
5
|
+
require 'pry'
|
6
|
+
|
7
|
+
Coyodlee.setup do |config|
|
8
|
+
config.host = 'developer.api.yodlee.com'
|
9
|
+
config.cobrand_login = ENV['YODLEE_COBRAND_LOGIN']
|
10
|
+
config.cobrand_password = ENV['YODLEE_COBRAND_PASSWORD']
|
11
|
+
end
|
12
|
+
|
13
|
+
conn = Coyodlee::Connection.create
|
14
|
+
|
15
|
+
resp = conn.start do |api|
|
16
|
+
session = Coyodlee::Session.create(api)
|
17
|
+
session.login_cobrand login_name: Coyodlee.cobrand_login,
|
18
|
+
password: Coyodlee.cobrand_password
|
19
|
+
session.login_user login_name: ENV['YODLEE_USER_1_LOGIN_NAME'],
|
20
|
+
password: ENV['YODLEE_USER_1_PASSWORD']
|
21
|
+
end
|
22
|
+
|
23
|
+
puts resp
|
data/lib/coyodlee.rb
CHANGED
@@ -1,15 +1,16 @@
|
|
1
1
|
require_relative 'coyodlee/version'
|
2
|
-
require_relative 'coyodlee/http_wrapper'
|
3
|
-
require 'json'
|
4
2
|
require 'yajl'
|
5
3
|
|
6
4
|
# The global Yodlee configuration object
|
7
5
|
module Coyodlee
|
8
6
|
|
9
7
|
class << self
|
10
|
-
# The
|
11
|
-
# @return [String] The
|
12
|
-
attr_accessor :
|
8
|
+
# The name of the Yodlee API host
|
9
|
+
# @return [String] The name of the Yodlee API host
|
10
|
+
attr_accessor :host
|
11
|
+
# The cobrand name
|
12
|
+
# @return [String] The cobrand name
|
13
|
+
attr_accessor :cobrand_name
|
13
14
|
# The login of your cobrand
|
14
15
|
# @return [String] The login of your cobrand
|
15
16
|
attr_accessor :cobrand_login
|
@@ -0,0 +1,207 @@
|
|
1
|
+
require_relative 'uri_builder'
|
2
|
+
require_relative 'facades'
|
3
|
+
require 'forwardable'
|
4
|
+
require 'net/http'
|
5
|
+
|
6
|
+
module Coyodlee
|
7
|
+
class RequestBuilder
|
8
|
+
extend Forwardable
|
9
|
+
|
10
|
+
def initialize(uri_builder)
|
11
|
+
@uri_builder = uri_builder
|
12
|
+
@session_authorization = nil
|
13
|
+
end
|
14
|
+
|
15
|
+
def_delegators :@uri_builder, :host
|
16
|
+
|
17
|
+
def authorize(session_authorization)
|
18
|
+
@session_authorization = session_authorization
|
19
|
+
end
|
20
|
+
|
21
|
+
def build(method, resource_path, headers: {}, params: {}, body: nil)
|
22
|
+
q = params.empty? ? nil : build_query(params)
|
23
|
+
uri = @uri_builder.build(resource_path, query: q)
|
24
|
+
http_constructor(method).new(uri).tap do |req|
|
25
|
+
add_headers(req, headers)
|
26
|
+
req.body = body if body
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
private
|
31
|
+
|
32
|
+
def build_query(params)
|
33
|
+
params
|
34
|
+
.to_a
|
35
|
+
.map { |keyval| keyval.join('=') }
|
36
|
+
.join('&')
|
37
|
+
end
|
38
|
+
|
39
|
+
def add_headers(req, headers)
|
40
|
+
if @session_authorization
|
41
|
+
headers['Authorization'] = @session_authorization.to_s
|
42
|
+
end
|
43
|
+
|
44
|
+
headers.each do |key, value|
|
45
|
+
req[key] = value
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def http_constructor(method)
|
50
|
+
case method
|
51
|
+
when :get
|
52
|
+
Net::HTTP::Get
|
53
|
+
when :post
|
54
|
+
Net::HTTP::Post
|
55
|
+
when :put
|
56
|
+
Net::HTTP::Put
|
57
|
+
when :delete
|
58
|
+
Net::HTTP::Delete
|
59
|
+
end
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
63
|
+
class RequestFacade
|
64
|
+
attr_reader :http
|
65
|
+
attr_reader :request_builder
|
66
|
+
|
67
|
+
extend Forwardable
|
68
|
+
include Facades
|
69
|
+
|
70
|
+
def initialize(http:, request_builder:)
|
71
|
+
@http = http
|
72
|
+
@request_builder = request_builder
|
73
|
+
@user_facade = UserFacade.new(self)
|
74
|
+
@cobrand_facade = CobrandFacade.new(self)
|
75
|
+
@accounts_facade = AccountsFacade.new(self)
|
76
|
+
@transactions_facade = TransactionsFacade.new(self)
|
77
|
+
@holdings_facade = HoldingsFacade.new(self)
|
78
|
+
@provider_accounts_facade = ProviderAccountsFacade.new(self)
|
79
|
+
end
|
80
|
+
|
81
|
+
def_delegators :@request_builder, :authorize, :build
|
82
|
+
|
83
|
+
def_delegator :@user_facade, :login, :login_user
|
84
|
+
def_delegator :@user_facade, :logout, :logout_user
|
85
|
+
def_delegator :@user_facade, :register, :register_user
|
86
|
+
def_delegator :@user_facade, :unregister, :unregister_user
|
87
|
+
|
88
|
+
def_delegator :@cobrand_facade, :login, :login_cobrand
|
89
|
+
def_delegator :@cobrand_facade, :logout, :logout_cobrand
|
90
|
+
def_delegator :@cobrand_facade, :public_key, :cobrand_public_key
|
91
|
+
|
92
|
+
def_delegator :@accounts_facade, :all, :accounts
|
93
|
+
def_delegator :@accounts_facade, :details, :account_details
|
94
|
+
def_delegator :@accounts_facade, :update, :update_account
|
95
|
+
def_delegator :@accounts_facade, :delete, :delete_account
|
96
|
+
def_delegator :@accounts_facade, :add_manually, :add_manual_account
|
97
|
+
def_delegator :@accounts_facade, :investment_options, :investment_options
|
98
|
+
def_delegator :@accounts_facade, :historical_balances, :historical_balances
|
99
|
+
|
100
|
+
def_delegator :@holdings_facade, :all, :holdings
|
101
|
+
def_delegators :@holdings_facade, :extended_securities_info, :holding_type_list, :asset_classification_list
|
102
|
+
|
103
|
+
def_delegator :@transactions_facade, :count, :transactions_count
|
104
|
+
def_delegator :@transactions_facade, :all, :transactions
|
105
|
+
def_delegator :@transactions_facade, :categorization_rules, :transaction_categorization_rules
|
106
|
+
def_delegator :@transactions_facade, :create_categorization_rule, :create_transaction_categorization_rule
|
107
|
+
def_delegator :@transactions_facade, :update_categorization_rule, :update_transaction_categorization_rule
|
108
|
+
def_delegator :@transactions_facade, :delete_categorization_rule, :delete_transaction_categorization_rule
|
109
|
+
def_delegator :@transactions_facade, :run_categorization_rule, :run_transaction_categorization_rule
|
110
|
+
def_delegator :@transactions_facade, :run_all_categorization_rule, :run_all_transaction_categorization_rule
|
111
|
+
def_delegator :@transactions_facade, :update, :update_transaction
|
112
|
+
def_delegator :@transactions_facade, :category_list, :transaction_category_list
|
113
|
+
def_delegator :@transactions_facade, :create_category, :create_transaction_category
|
114
|
+
def_delegator :@transactions_facade, :update_category, :update_transaction_category
|
115
|
+
def_delegator :@transactions_facade, :delete_category, :delete_transaction_category
|
116
|
+
|
117
|
+
def_delegator :@provider_accounts_facade, :add, :add_provider_account
|
118
|
+
def_delegator :@provider_accounts_facade, :details, :provider_account_details
|
119
|
+
def_delegator :@provider_accounts_facade, :delete, :delete_provider_account
|
120
|
+
def_delegator :@provider_accounts_facade, :update, :update_provider_account
|
121
|
+
def_delegator :@provider_accounts_facade, :verify, :verify_provider_account
|
122
|
+
def_delegator :@provider_accounts_facade, :verification_status, :provider_account_verification_status
|
123
|
+
|
124
|
+
def providers(params={})
|
125
|
+
headers = { 'Accept' => 'application/json' }
|
126
|
+
req = @request_builder.build(:get, "providers", headers: headers, params: params)
|
127
|
+
execute(req)
|
128
|
+
end
|
129
|
+
|
130
|
+
def provider_details(provider_id:, provider_account_id:)
|
131
|
+
headers = { 'Accept' => 'application/json' }
|
132
|
+
params = { 'providerAccountId' => provider_account_id }
|
133
|
+
req = @request_builder.build(:get, "providers/#{provider_id}", headers: headers, params: params)
|
134
|
+
execute(req)
|
135
|
+
end
|
136
|
+
|
137
|
+
def statements(params={})
|
138
|
+
headers = { 'Accept' => 'application/json' }
|
139
|
+
req = @request_builder.build(:get, 'statements', headers: headers, params: params)
|
140
|
+
execute(req)
|
141
|
+
end
|
142
|
+
|
143
|
+
def transaction_summary(group_by:, params: {})
|
144
|
+
params['groupBy'] = group_by
|
145
|
+
headers = { 'Accept' => 'application/json' }
|
146
|
+
req = @request_builder.build(:get, 'derived/transactionSummary', headers: headers, params: params)
|
147
|
+
execute(req)
|
148
|
+
end
|
149
|
+
|
150
|
+
def holding_summary(params={})
|
151
|
+
headers = { 'Accept' => 'application/json' }
|
152
|
+
req = @request_builder.build(:get, 'derived/holdingSummary', headers: headers, params: params)
|
153
|
+
execute(req)
|
154
|
+
end
|
155
|
+
|
156
|
+
def networth_summary(params={})
|
157
|
+
headers = { 'Accept' => 'application/json' }
|
158
|
+
req = @request_builder.build(:get, 'derived/networth', headers: headers, params: params)
|
159
|
+
execute(req)
|
160
|
+
end
|
161
|
+
|
162
|
+
def extract_events(event_name:, from_date:, to_date:)
|
163
|
+
params = {
|
164
|
+
'eventName' => event_name,
|
165
|
+
'fromDate' => fromDate,
|
166
|
+
'toDate' => toDate
|
167
|
+
}
|
168
|
+
headers = { 'Accept' => 'application/json' }
|
169
|
+
req = @request_builder.build(:get, 'dataExtracts/events', headers: headers, params: params)
|
170
|
+
execute(req)
|
171
|
+
end
|
172
|
+
|
173
|
+
def user_data(login_name:, from_date:, to_date:)
|
174
|
+
params = {
|
175
|
+
'loginName' => login_name,
|
176
|
+
'fromDate' => fromDate,
|
177
|
+
'toDate' => toDate
|
178
|
+
}
|
179
|
+
headers = { 'Accept' => 'application/json' }
|
180
|
+
req = @request_builder.build(:get, 'dataExtracts/userData', headers: headers, params: params)
|
181
|
+
execute(req)
|
182
|
+
end
|
183
|
+
|
184
|
+
def execute(req)
|
185
|
+
http.request(req)
|
186
|
+
end
|
187
|
+
end
|
188
|
+
|
189
|
+
class Connection
|
190
|
+
class << self
|
191
|
+
def create
|
192
|
+
new RequestBuilder.new(UriBuilder.new(host: Coyodlee.host))
|
193
|
+
end
|
194
|
+
end
|
195
|
+
|
196
|
+
def initialize(request_builder)
|
197
|
+
@request_builder = request_builder
|
198
|
+
end
|
199
|
+
|
200
|
+
def start(&block)
|
201
|
+
Net::HTTP.start(@request_builder.host, use_ssl: true) do |http|
|
202
|
+
yield RequestFacade.new(http: http,
|
203
|
+
request_builder: @request_builder)
|
204
|
+
end
|
205
|
+
end
|
206
|
+
end
|
207
|
+
end
|
@@ -0,0 +1,6 @@
|
|
1
|
+
require_relative 'facades/accounts_facade'
|
2
|
+
require_relative 'facades/user_facade'
|
3
|
+
require_relative 'facades/cobrand_facade'
|
4
|
+
require_relative 'facades/transactions_facade'
|
5
|
+
require_relative 'facades/holdings_facade'
|
6
|
+
require_relative 'facades/provider_accounts_facade'
|
@@ -0,0 +1,52 @@
|
|
1
|
+
module Coyodlee
|
2
|
+
module Facades
|
3
|
+
class AccountsFacade
|
4
|
+
def initialize(request_facade)
|
5
|
+
@request_facade = request_facade
|
6
|
+
end
|
7
|
+
|
8
|
+
def all
|
9
|
+
headers = { 'Accept' => 'application/json' }
|
10
|
+
req = @request_facade.build(:get, 'accounts', headers: headers)
|
11
|
+
@request_facade.execute(req)
|
12
|
+
end
|
13
|
+
|
14
|
+
def details(account_id:, container:)
|
15
|
+
headers = { 'Accept' => 'application/json' }
|
16
|
+
params = { container: container }
|
17
|
+
req = @request_facade.build(:get, "accounts/#{account_id}", params: params, headers: headers)
|
18
|
+
@request_facade.execute(req)
|
19
|
+
end
|
20
|
+
|
21
|
+
def update(account_id:, body:)
|
22
|
+
headers = { 'Accept' => 'application/json', 'Content-Type' => 'application/json' }
|
23
|
+
req = @request_facade.build(:put, "accounts/#{account_id}", headers: headers, body: body.to_json)
|
24
|
+
@request_facade.execute(req)
|
25
|
+
end
|
26
|
+
|
27
|
+
def delete(account_id:)
|
28
|
+
headers = { 'Accept' => 'application/json' }
|
29
|
+
req = @request_facade.build(:delete, "accounts/#{account_id}", headers: headers)
|
30
|
+
@request_facade.execute(req)
|
31
|
+
end
|
32
|
+
|
33
|
+
def add_manually(body:)
|
34
|
+
headers = { 'Accept' => 'application/json', 'Content-Type' => 'application/json' }
|
35
|
+
req = @request_facade.build(:post, 'accounts', headers: headers, body: body.to_json)
|
36
|
+
@request_facade.execute(req)
|
37
|
+
end
|
38
|
+
|
39
|
+
def investment_options(params={})
|
40
|
+
headers = { 'Accept' => 'application/json' }
|
41
|
+
req = @request_facade.build(:get, 'accounts/investmentPlan/investmentOptions', headers: headers, params: params)
|
42
|
+
@request_facade.execute(req)
|
43
|
+
end
|
44
|
+
|
45
|
+
def historical_balances(params={})
|
46
|
+
headers = { 'Accept' => 'application/json' }
|
47
|
+
req = @request_facade.build(:get, 'accounts/historicalBalances', headers: headers, params: params)
|
48
|
+
@request_facade.execute(req)
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|