Class: Plaid::RequestedScopes

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

Overview

Scope of required and optional account features or content from a ConnectedApplication.

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(required_product_access:, optional_product_access:, account_selection_cardinality:, account_filters: SKIP, additional_properties: nil) ⇒ RequestedScopes

Returns a new instance of RequestedScopes.



63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/plaid/models/requested_scopes.rb', line 63

def initialize(required_product_access:, optional_product_access:,
               account_selection_cardinality:, account_filters: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @required_product_access = required_product_access
  @optional_product_access = optional_product_access
  @account_filters =  unless  == SKIP
  @account_selection_cardinality = 
  @additional_properties = additional_properties
end

Instance Attribute Details

#account_filtersAccountFilter

Enumerates the account subtypes that the application wishes for the user to be able to select from. For more details refer to Plaid documentation on account filters.

Returns:



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

def 
  @account_filters
end

#account_selection_cardinalityAccountSelectionCardinality

The application requires that accounts be limited to a specific cardinality. ‘MULTI_SELECT`: indicates that the user should be allowed to pick multiple accounts. `SINGLE_SELECT`: indicates that the user should be allowed to pick only a single account. `ALL`: indicates that the user must share all of their accounts and should not be given the opportunity to de-select



38
39
40
# File 'lib/plaid/models/requested_scopes.rb', line 38

def 
  @account_selection_cardinality
end

#optional_product_accessProductAccess

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

Returns:



21
22
23
# File 'lib/plaid/models/requested_scopes.rb', line 21

def optional_product_access
  @optional_product_access
end

#required_product_accessProductAccess

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

Returns:



16
17
18
# File 'lib/plaid/models/requested_scopes.rb', line 16

def required_product_access
  @required_product_access
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/plaid/models/requested_scopes.rb', line 77

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  required_product_access = ProductAccess.from_hash(hash['required_product_access']) if
    hash['required_product_access']
  optional_product_access = ProductAccess.from_hash(hash['optional_product_access']) if
    hash['optional_product_access']
   =
    hash.key?('account_selection_cardinality') ? hash['account_selection_cardinality'] : nil
   = AccountFilter.from_hash(hash['account_filters']) if
    hash['account_filters']

  # 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.
  RequestedScopes.new(required_product_access: required_product_access,
                      optional_product_access: optional_product_access,
                      account_selection_cardinality: ,
                      account_filters: ,
                      additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['required_product_access'] = 'required_product_access'
  @_hash['optional_product_access'] = 'optional_product_access'
  @_hash['account_filters'] = 'account_filters'
  @_hash['account_selection_cardinality'] =
    'account_selection_cardinality'
  @_hash
end

.nullablesObject

An array for nullable fields



59
60
61
# File 'lib/plaid/models/requested_scopes.rb', line 59

def self.nullables
  []
end

.optionalsObject

An array for optional fields



52
53
54
55
56
# File 'lib/plaid/models/requested_scopes.rb', line 52

def self.optionals
  %w[
    account_filters
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



115
116
117
118
119
120
121
122
# File 'lib/plaid/models/requested_scopes.rb', line 115

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} required_product_access: #{@required_product_access.inspect},"\
  " optional_product_access: #{@optional_product_access.inspect}, account_filters:"\
  " #{@account_filters.inspect}, account_selection_cardinality:"\
  " #{@account_selection_cardinality.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



106
107
108
109
110
111
112
# File 'lib/plaid/models/requested_scopes.rb', line 106

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} required_product_access: #{@required_product_access},"\
  " optional_product_access: #{@optional_product_access}, account_filters:"\
  " #{@account_filters}, account_selection_cardinality: #{@account_selection_cardinality},"\
  " additional_properties: #{@additional_properties}>"
end