Class: ThePlaidApi::AccountAccess

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/the_plaid_api/models/account_access.rb

Overview

Allow or disallow product access by account. Unlisted (e.g. missing) accounts will be considered ‘new_accounts`.

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(unique_id:, authorized: true, account_product_access: SKIP, additional_properties: nil) ⇒ AccountAccess

Returns a new instance of AccountAccess.



52
53
54
55
56
57
58
59
60
61
# File 'lib/the_plaid_api/models/account_access.rb', line 52

def initialize(unique_id:, authorized: true, account_product_access: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @unique_id = unique_id
  @authorized = authorized unless authorized == SKIP
  @account_product_access =  unless  == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#account_product_accessAccountProductAccessNullable

Allow the application to access specific products on this account



25
26
27
# File 'lib/the_plaid_api/models/account_access.rb', line 25

def 
  @account_product_access
end

#authorizedTrueClass | FalseClass

Allow the application to see this account (and associated details, including balance) in the list of accounts If unset, defaults to ‘true`.

Returns:

  • (TrueClass | FalseClass)


21
22
23
# File 'lib/the_plaid_api/models/account_access.rb', line 21

def authorized
  @authorized
end

#unique_idString

The unique account identifier for this account. This value must match that returned by the data access API for this account.

Returns:

  • (String)


16
17
18
# File 'lib/the_plaid_api/models/account_access.rb', line 16

def unique_id
  @unique_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/the_plaid_api/models/account_access.rb', line 64

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  unique_id = hash.key?('unique_id') ? hash['unique_id'] : nil
  authorized = hash['authorized'] ||= true
  if hash['account_product_access']
     = AccountProductAccessNullable.from_hash(hash['account_product_access'])
  end

  # 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.
  AccountAccess.new(unique_id: unique_id,
                    authorized: authorized,
                    account_product_access: ,
                    additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



28
29
30
31
32
33
34
# File 'lib/the_plaid_api/models/account_access.rb', line 28

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['unique_id'] = 'unique_id'
  @_hash['authorized'] = 'authorized'
  @_hash['account_product_access'] = 'account_product_access'
  @_hash
end

.nullablesObject

An array for nullable fields



45
46
47
48
49
50
# File 'lib/the_plaid_api/models/account_access.rb', line 45

def self.nullables
  %w[
    authorized
    account_product_access
  ]
end

.optionalsObject

An array for optional fields



37
38
39
40
41
42
# File 'lib/the_plaid_api/models/account_access.rb', line 37

def self.optionals
  %w[
    authorized
    account_product_access
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



97
98
99
100
101
102
# File 'lib/the_plaid_api/models/account_access.rb', line 97

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} unique_id: #{@unique_id.inspect}, authorized: #{@authorized.inspect},"\
  " account_product_access: #{@account_product_access.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



89
90
91
92
93
94
# File 'lib/the_plaid_api/models/account_access.rb', line 89

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} unique_id: #{@unique_id}, authorized: #{@authorized},"\
  " account_product_access: #{@account_product_access}, additional_properties:"\
  " #{@additional_properties}>"
end