Module: Plaid::Client::Bodies

Includes:
Configurations
Included in:
Base, ThinClient
Defined in:
lib/plaid/client/body.rb

Instance Method Summary collapse

Instance Method Details

#bodyObject

Used before the organization is obtained and chosen by the user



7
8
9
10
11
12
# File 'lib/plaid/client/body.rb', line 7

def body
  {
      :client_id => self.client_id,
      :secret => self.secret
  }
end

#body_delete_userObject



44
45
46
47
48
# File 'lib/plaid/client/body.rb', line 44

def body_delete_user
  ret = Hash.new
  ret[:access_token] = self.access_token
  ret.merge(body)
end

#body_entity(entity_id) ⇒ Object

simple hash providing the entity_id to plaid.



73
74
75
76
77
78
# File 'lib/plaid/client/body.rb', line 73

def body_entity(entity_id)
  {
    :entity_id => entity_id,
    :options => {"pretty"=>"true"}
  }
end

#body_init_userObject



105
106
107
108
109
110
# File 'lib/plaid/client/body.rb', line 105

def body_init_user
  ret = body_original
  z = {"login" => true, "webhook" => webhook_address}
  ret[:options] = body_original[:options].merge(z)
  ret
end

#body_mfa(answer) ⇒ Object

adds an mfa answer to the body. based on #body



82
83
84
85
86
87
88
# File 'lib/plaid/client/body.rb', line 82

def body_mfa(answer)
  ret = Hash.new
  ret[:mfa] = answer.to_s
  ret[:access_token] = self.access_token
  ret[:type] = self.institution
  ret.merge(body)
end

#body_mfa_mode(mode) ⇒ Object



97
98
99
100
101
102
103
# File 'lib/plaid/client/body.rb', line 97

def body_mfa_mode(mode)
  ret = Hash.new
  ret[:options] = options(nil, "send_method", mode)
  ret[:access_token] = self.access_token
  ret[:type] = self.institution
  ret.merge(body)
end

#body_mfa_webhook(answer) ⇒ Object

adds a webhook address to #body_mfa



91
92
93
94
95
# File 'lib/plaid/client/body.rb', line 91

def body_mfa_webhook(answer)
  ret = Hash.new
  ret[:options] = options(nil,"webhook", webhook_address )
  ret.merge(body_mfa(answer))
end

#body_originalObject

the fundamental body object used in most calls to Plaid.

  • client_id

  • secret

  • institution_type

  • credentials

  • email

  • options “list”:true



57
58
59
60
61
62
63
64
# File 'lib/plaid/client/body.rb', line 57

def body_original
  ret = Hash.new
  ret[:type] = self.institution
  ret[:credentials] = credentials
  ret[:email] = self.email
  ret[:options] = {"list" => true}
  ret.merge(body)
end

#body_retrieveObject

For accessing balances associated with an access_token via a GET

  • client_id

  • secret

  • access_token

  • institution type

  • email of the user



20
21
22
23
24
25
26
# File 'lib/plaid/client/body.rb', line 20

def body_retrieve
  ret = Hash.new
  ret[:access_token] = self.access_token
  ret[:type] = self.institution
  ret[:email] = self.email
  ret.merge(body)
end

#body_testObject



66
67
68
69
70
# File 'lib/plaid/client/body.rb', line 66

def body_test
  ret = hash.new
  ret[:options] = options(nil,"pretty","true")
  ret.merge(body_original)
end

#body_update_credentialsObject



36
37
38
39
40
41
42
# File 'lib/plaid/client/body.rb', line 36

def body_update_credentials
  ret = Hash.new
  ret[:access_token] = self.access_token
  ret[:credentials] = credentials
  ret[:type] = self.institution
  ret.merge(body)
end

#credentialsObject

Structure to proxy credentials to Plaid for access to the financial institution



29
30
31
32
33
34
# File 'lib/plaid/client/body.rb', line 29

def credentials
  {
      "username" => self.username,
      "password" => self.password
  }
end

#options(original_hash = nil, key, value) ⇒ Object

helper method to add options to an option hash



113
114
115
116
117
118
# File 'lib/plaid/client/body.rb', line 113

def options(original_hash=nil, key, value)
  j = Hash.new
  j[key] = value
  j.merge(original_hash) unless original_hash.nil?
  j
end