Class: ThePlaidApi::ConnectedApplication

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

Overview

Describes the connected application for a particular end user.

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(application_id:, name:, created_at:, display_name: SKIP, logo_url: SKIP, application_url: SKIP, reason_for_access: SKIP, scopes: SKIP, additional_properties: nil) ⇒ ConnectedApplication

Returns a new instance of ConnectedApplication.



85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# File 'lib/the_plaid_api/models/connected_application.rb', line 85

def initialize(application_id:, name:, created_at:, display_name: SKIP,
               logo_url: SKIP, application_url: SKIP,
               reason_for_access: SKIP, scopes: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @application_id = application_id
  @name = name
  @display_name = display_name unless display_name == SKIP
  @logo_url = logo_url unless logo_url == SKIP
  @application_url = application_url unless application_url == SKIP
  @reason_for_access = reason_for_access unless reason_for_access == SKIP
  @created_at = created_at
  @scopes = scopes unless scopes == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#application_idString

This field will map to the application ID that is returned from /item/application/list, or provided to the institution in an oauth redirect.

Returns:

  • (String)


17
18
19
# File 'lib/the_plaid_api/models/connected_application.rb', line 17

def application_id
  @application_id
end

#application_urlString

The URL for the application’s website

Returns:

  • (String)


33
34
35
# File 'lib/the_plaid_api/models/connected_application.rb', line 33

def application_url
  @application_url
end

#created_atDateTime

The date this application was linked in [ISO 8601](wikipedia.org/wiki/ISO_8601) (YYYY-MM-DD) format in UTC.

Returns:

  • (DateTime)


43
44
45
# File 'lib/the_plaid_api/models/connected_application.rb', line 43

def created_at
  @created_at
end

#display_nameString

A human-readable name of the application for display purposes

Returns:

  • (String)


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

def display_name
  @display_name
end

#logo_urlString

A URL that links to the application logo image.

Returns:

  • (String)


29
30
31
# File 'lib/the_plaid_api/models/connected_application.rb', line 29

def logo_url
  @logo_url
end

#nameString

The name of the application

Returns:

  • (String)


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

def name
  @name
end

#reason_for_accessString

A string provided by the connected app stating why they use their respective enabled products.

Returns:

  • (String)


38
39
40
# File 'lib/the_plaid_api/models/connected_application.rb', line 38

def reason_for_access
  @reason_for_access
end

#scopesScopesNullable

The scopes object

Returns:



47
48
49
# File 'lib/the_plaid_api/models/connected_application.rb', line 47

def scopes
  @scopes
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
# File 'lib/the_plaid_api/models/connected_application.rb', line 104

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  application_id =
    hash.key?('application_id') ? hash['application_id'] : nil
  name = hash.key?('name') ? hash['name'] : nil
  created_at = if hash.key?('created_at')
                 (DateTimeHelper.from_rfc3339(hash['created_at']) if hash['created_at'])
               end
  display_name = hash.key?('display_name') ? hash['display_name'] : SKIP
  logo_url = hash.key?('logo_url') ? hash['logo_url'] : SKIP
  application_url =
    hash.key?('application_url') ? hash['application_url'] : SKIP
  reason_for_access =
    hash.key?('reason_for_access') ? hash['reason_for_access'] : SKIP
  scopes = ScopesNullable.from_hash(hash['scopes']) if hash['scopes']

  # 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.
  ConnectedApplication.new(application_id: application_id,
                           name: name,
                           created_at: created_at,
                           display_name: display_name,
                           logo_url: logo_url,
                           application_url: application_url,
                           reason_for_access: reason_for_access,
                           scopes: scopes,
                           additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['application_id'] = 'application_id'
  @_hash['name'] = 'name'
  @_hash['display_name'] = 'display_name'
  @_hash['logo_url'] = 'logo_url'
  @_hash['application_url'] = 'application_url'
  @_hash['reason_for_access'] = 'reason_for_access'
  @_hash['created_at'] = 'created_at'
  @_hash['scopes'] = 'scopes'
  @_hash
end

.nullablesObject

An array for nullable fields



75
76
77
78
79
80
81
82
83
# File 'lib/the_plaid_api/models/connected_application.rb', line 75

def self.nullables
  %w[
    display_name
    logo_url
    application_url
    reason_for_access
    scopes
  ]
end

.optionalsObject

An array for optional fields



64
65
66
67
68
69
70
71
72
# File 'lib/the_plaid_api/models/connected_application.rb', line 64

def self.optionals
  %w[
    display_name
    logo_url
    application_url
    reason_for_access
    scopes
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



155
156
157
158
159
160
161
162
# File 'lib/the_plaid_api/models/connected_application.rb', line 155

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} application_id: #{@application_id.inspect}, name: #{@name.inspect},"\
  " display_name: #{@display_name.inspect}, logo_url: #{@logo_url.inspect}, application_url:"\
  " #{@application_url.inspect}, reason_for_access: #{@reason_for_access.inspect}, created_at:"\
  " #{@created_at.inspect}, scopes: #{@scopes.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_custom_created_atObject



141
142
143
# File 'lib/the_plaid_api/models/connected_application.rb', line 141

def to_custom_created_at
  DateTimeHelper.to_rfc3339(created_at)
end

#to_sObject

Provides a human-readable string representation of the object.



146
147
148
149
150
151
152
# File 'lib/the_plaid_api/models/connected_application.rb', line 146

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} application_id: #{@application_id}, name: #{@name}, display_name:"\
  " #{@display_name}, logo_url: #{@logo_url}, application_url: #{@application_url},"\
  " reason_for_access: #{@reason_for_access}, created_at: #{@created_at}, scopes: #{@scopes},"\
  " additional_properties: #{@additional_properties}>"
end