Class: Plaid::Info

Inherits:
Object
  • Object
show all
Defined in:
lib/plaid/info.rb

Overview

Public: Representation of user information.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(fields) ⇒ Info

Internal: Construct the Info object.



30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/plaid/info.rb', line 30

def initialize(fields)
  @names = fields['names']
  @emails = fields['emails'].map do |h|
    symbolize_values Plaid.symbolize_hash(h), :type
  end

  @phone_numbers = fields['phone_numbers'].map do |h|
    symbolize_values Plaid.symbolize_hash(h), :type
  end

  @addresses = fields['addresses'].map do |h|
    Plaid.symbolize_hash(h)
  end
end

Instance Attribute Details

#addressesObject (readonly)

Public: The Array of Hash user address information.

E.g. [{ primary: true, data:

"street" => "1 Hobbit Way",
"city" => "The Shire",
"state" => "CA",
"zip" => "94108"}]


27
28
29
# File 'lib/plaid/info.rb', line 27

def addresses
  @addresses
end

#emailsObject (readonly)

Public: The Array of Hash user emails information.

E.g. [“[email protected]”, type: :primary, …]



12
13
14
# File 'lib/plaid/info.rb', line 12

def emails
  @emails
end

#namesObject (readonly)

Public: The Array of String user names.

E.g. [“Frodo Baggins”, “Samwise Gamgee”].



7
8
9
# File 'lib/plaid/info.rb', line 7

def names
  @names
end

#phone_numbersObject (readonly)

Public: The Array of Hash user phone number information.

E.g. [“111-222-3456”, type: :work, primary: false,

{data: "123-456-7891", type: :mobile, primary: true}]


18
19
20
# File 'lib/plaid/info.rb', line 18

def phone_numbers
  @phone_numbers
end

Instance Method Details

#inspectObject Also known as: to_s

Public: Get a String representation of Info object.

Returns a String.



48
49
50
# File 'lib/plaid/info.rb', line 48

def inspect
  "#<Plaid::Info names=#{names.inspect}, ...>"
end