Class: Coyodlee::RequestFacade

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
Facades
Defined in:
lib/coyodlee/connection.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(http:, request_builder:) ⇒ RequestFacade

Returns a new instance of RequestFacade.


80
81
82
83
84
85
86
87
88
89
# File 'lib/coyodlee/connection.rb', line 80

def initialize(http:, request_builder:)
  @http = http
  @request_builder = request_builder
  @user_facade = UserFacade.new(self)
  @cobrand_facade = CobrandFacade.new(self)
  @accounts_facade = AccountsFacade.new(self)
  @transactions_facade = TransactionsFacade.new(self)
  @holdings_facade = HoldingsFacade.new(self)
  @provider_accounts_facade = ProviderAccountsFacade.new(self)
end

Instance Attribute Details

#httpObject (readonly)

Returns the value of attribute http


74
75
76
# File 'lib/coyodlee/connection.rb', line 74

def http
  @http
end

#request_builderObject (readonly)

Returns the value of attribute request_builder


75
76
77
# File 'lib/coyodlee/connection.rb', line 75

def request_builder
  @request_builder
end

Instance Method Details

#cobrand_public_keyObject


117
# File 'lib/coyodlee/connection.rb', line 117

def_delegator :@cobrand_facade, :public_key, :cobrand_public_key

#execute(req) ⇒ Object


211
212
213
# File 'lib/coyodlee/connection.rb', line 211

def execute(req)
  http.request(req)
end

#extract_events(event_name:, from_date:, to_date:) ⇒ Object


189
190
191
192
193
194
195
196
197
198
# File 'lib/coyodlee/connection.rb', line 189

def extract_events(event_name:, from_date:, to_date:)
  params = {
    'eventName' => event_name,
    'fromDate' => fromDate,
    'toDate' => toDate
  }
  headers = { 'Accept' => 'application/json' }
  req = @request_builder.build(:get, 'dataExtracts/events', headers: headers, params: params)
  execute(req)
end

#holding_summary(params = {}) ⇒ Object


177
178
179
180
181
# File 'lib/coyodlee/connection.rb', line 177

def holding_summary(params={})
  headers = { 'Accept' => 'application/json' }
  req = @request_builder.build(:get, 'derived/holdingSummary', headers: headers, params: params)
  execute(req)
end

#login_cobrandObject


111
# File 'lib/coyodlee/connection.rb', line 111

def_delegator :@cobrand_facade, :login, :login_cobrand

#login_userObject


95
# File 'lib/coyodlee/connection.rb', line 95

def_delegator :@user_facade, :login, :login_user

#logout_cobrandObject


114
# File 'lib/coyodlee/connection.rb', line 114

def_delegator :@cobrand_facade, :logout, :logout_cobrand

#logout_userObject


98
# File 'lib/coyodlee/connection.rb', line 98

def_delegator :@user_facade, :logout, :logout_user

#networth_summary(params = {}) ⇒ Object


183
184
185
186
187
# File 'lib/coyodlee/connection.rb', line 183

def networth_summary(params={})
  headers = { 'Accept' => 'application/json' }
  req = @request_builder.build(:get, 'derived/networth', headers: headers, params: params)
  execute(req)
end

#provider_details(provider_id:, provider_account_id:) ⇒ Object


157
158
159
160
161
162
# File 'lib/coyodlee/connection.rb', line 157

def provider_details(provider_id:, provider_account_id:)
  headers = { 'Accept' => 'application/json' }
  params = { 'providerAccountId' =>  }
  req = @request_builder.build(:get, "providers/#{provider_id}", headers: headers, params: params)
  execute(req)
end

#providers(params = {}) ⇒ Object


151
152
153
154
155
# File 'lib/coyodlee/connection.rb', line 151

def providers(params={})
  headers = { 'Accept' => 'application/json' }
  req = @request_builder.build(:get, "providers", headers: headers, params: params)
  execute(req)
end

#register_userObject


104
# File 'lib/coyodlee/connection.rb', line 104

def_delegator :@user_facade, :register, :register_user

#statements(params = {}) ⇒ Object


164
165
166
167
168
# File 'lib/coyodlee/connection.rb', line 164

def statements(params={})
  headers = { 'Accept' => 'application/json' }
  req = @request_builder.build(:get, 'statements', headers: headers, params: params)
  execute(req)
end

#transaction_summary(group_by:, params: {}) ⇒ Object


170
171
172
173
174
175
# File 'lib/coyodlee/connection.rb', line 170

def transaction_summary(group_by:, params: {})
  params['groupBy'] = group_by
  headers = { 'Accept' => 'application/json' }
  req = @request_builder.build(:get, 'derived/transactionSummary', headers: headers, params: params)
  execute(req)
end

#unregister_userObject


107
# File 'lib/coyodlee/connection.rb', line 107

def_delegator :@user_facade, :unregister, :unregister_user

#user_access_tokensObject


101
# File 'lib/coyodlee/connection.rb', line 101

def_delegator :@user_facade, :access_tokens, :user_access_tokens

#user_data(login_name:, from_date:, to_date:) ⇒ Object


200
201
202
203
204
205
206
207
208
209
# File 'lib/coyodlee/connection.rb', line 200

def user_data(login_name:, from_date:, to_date:)
  params = {
    'loginName' => ,
    'fromDate' => fromDate,
    'toDate' => toDate
  }
  headers = { 'Accept' => 'application/json' }
  req = @request_builder.build(:get, 'dataExtracts/userData', headers: headers, params: params)
  execute(req)
end