Class: Plaid::ProductAccess

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/plaid/models/product_access.rb

Overview

The product access being requested. Used to or disallow product access across all accounts. If unset, defaults to all products allowed.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(statements: true, identity: true, auth: true, transactions: true, additional_properties: nil) ⇒ ProductAccess

Returns a new instance of ProductAccess.



60
61
62
63
64
65
66
67
68
69
70
# File 'lib/plaid/models/product_access.rb', line 60

def initialize(statements: true, identity: true, auth: true,
               transactions: true, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @statements = statements unless statements == SKIP
  @identity = identity unless identity == SKIP
  @auth = auth unless auth == SKIP
  @transactions = transactions unless transactions == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#authTrueClass | FalseClass

Allow access to account number details. If unset, defaults to ‘true`.

Returns:

  • (TrueClass | FalseClass)


24
25
26
# File 'lib/plaid/models/product_access.rb', line 24

def auth
  @auth
end

#identityTrueClass | FalseClass

Allow access to the Identity product (name, email, phone, address). If unset, defaults to ‘true`.

Returns:

  • (TrueClass | FalseClass)


20
21
22
# File 'lib/plaid/models/product_access.rb', line 20

def identity
  @identity
end

#statementsTrueClass | FalseClass

Allow access to statements. If unset, defaults to ‘true`.

Returns:

  • (TrueClass | FalseClass)


15
16
17
# File 'lib/plaid/models/product_access.rb', line 15

def statements
  @statements
end

#transactionsTrueClass | FalseClass

Allow access to transaction details. If unset, defaults to ‘true`.

Returns:

  • (TrueClass | FalseClass)


28
29
30
# File 'lib/plaid/models/product_access.rb', line 28

def transactions
  @transactions
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/plaid/models/product_access.rb', line 73

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  statements = hash['statements'] ||= true
  identity = hash['identity'] ||= true
  auth = hash['auth'] ||= true
  transactions = hash['transactions'] ||= true

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  ProductAccess.new(statements: statements,
                    identity: identity,
                    auth: auth,
                    transactions: transactions,
                    additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



31
32
33
34
35
36
37
38
# File 'lib/plaid/models/product_access.rb', line 31

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['statements'] = 'statements'
  @_hash['identity'] = 'identity'
  @_hash['auth'] = 'auth'
  @_hash['transactions'] = 'transactions'
  @_hash
end

.nullablesObject

An array for nullable fields



51
52
53
54
55
56
57
58
# File 'lib/plaid/models/product_access.rb', line 51

def self.nullables
  %w[
    statements
    identity
    auth
    transactions
  ]
end

.optionalsObject

An array for optional fields



41
42
43
44
45
46
47
48
# File 'lib/plaid/models/product_access.rb', line 41

def self.optionals
  %w[
    statements
    identity
    auth
    transactions
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



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

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} statements: #{@statements.inspect}, identity: #{@identity.inspect}, auth:"\
  " #{@auth.inspect}, transactions: #{@transactions.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



98
99
100
101
102
# File 'lib/plaid/models/product_access.rb', line 98

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} statements: #{@statements}, identity: #{@identity}, auth: #{@auth},"\
  " transactions: #{@transactions}, additional_properties: #{@additional_properties}>"
end