Class: FdxV660Api::ConsentGrantEntity

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/fdx_v660_api/models/consent_grant_entity.rb

Overview

Record of user consent

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(customer_id: SKIP, parties: SKIP, duration_type: SKIP, duration_period: SKIP, lookback_period: SKIP, resources: SKIP, account_selection_filters: SKIP, id: SKIP, status: SKIP, created_time: SKIP, expiration_time: SKIP, updated_time: SKIP, links: SKIP, additional_properties: nil) ⇒ ConsentGrantEntity

Returns a new instance of ConsentGrantEntity.



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
# File 'lib/fdx_v660_api/models/consent_grant_entity.rb', line 112

def initialize(customer_id: SKIP, parties: SKIP, duration_type: SKIP,
               duration_period: SKIP, lookback_period: SKIP,
               resources: SKIP, account_selection_filters: SKIP, id: SKIP,
               status: SKIP, created_time: SKIP, expiration_time: SKIP,
               updated_time: SKIP, links: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @customer_id = customer_id unless customer_id == SKIP
  @parties = parties unless parties == SKIP
  @duration_type = duration_type unless duration_type == SKIP
  @duration_period = duration_period unless duration_period == SKIP
  @lookback_period = lookback_period unless lookback_period == SKIP
  @resources = resources unless resources == SKIP
  unless  == SKIP
    @account_selection_filters =
      
  end
  @id = id unless id == SKIP
  @status = status unless status == SKIP
  @created_time = created_time unless created_time == SKIP
  @expiration_time = expiration_time unless expiration_time == SKIP
  @updated_time = updated_time unless updated_time == SKIP
  @links = links unless links == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#account_selection_filtersAccountSelectionFilters1

Optional filters indicating which account constraints are eligible for, or required by, the Data Recipient for authorization



43
44
45
# File 'lib/fdx_v660_api/models/consent_grant_entity.rb', line 43

def 
  @account_selection_filters
end

#created_timeDateTime

When the consent was initially granted

Returns:

  • (DateTime)


55
56
57
# File 'lib/fdx_v660_api/models/consent_grant_entity.rb', line 55

def created_time
  @created_time
end

#customer_idString

Long-term persistent identity of the customer. This identity must be unique to the owning institution.

Returns:

  • (String)


16
17
18
# File 'lib/fdx_v660_api/models/consent_grant_entity.rb', line 16

def customer_id
  @customer_id
end

#duration_periodInteger

The consent duration in days from day of original grant

Returns:

  • (Integer)


29
30
31
# File 'lib/fdx_v660_api/models/consent_grant_entity.rb', line 29

def duration_period
  @duration_period
end

#duration_typeConsentDurationType2

The type of duration of the consent



25
26
27
# File 'lib/fdx_v660_api/models/consent_grant_entity.rb', line 25

def duration_type
  @duration_type
end

#expiration_timeDateTime

When the consent grant will become expired

Returns:

  • (DateTime)


59
60
61
# File 'lib/fdx_v660_api/models/consent_grant_entity.rb', line 59

def expiration_time
  @expiration_time
end

#idString

The persistent identifier of the consent

Returns:

  • (String)


47
48
49
# File 'lib/fdx_v660_api/models/consent_grant_entity.rb', line 47

def id
  @id
end

Links for related Consent Grant records

Returns:



67
68
69
# File 'lib/fdx_v660_api/models/consent_grant_entity.rb', line 67

def links
  @links
end

#lookback_periodInteger

Period, in days, for which historical data may be requested; measured from request time, not grant time

Returns:

  • (Integer)


34
35
36
# File 'lib/fdx_v660_api/models/consent_grant_entity.rb', line 34

def lookback_period
  @lookback_period
end

#partiesArray[PartyEntity]

The non-end user parties participating in the Consent Grant. May include multiple parties, but should reference a single Data Recipient

Returns:



21
22
23
# File 'lib/fdx_v660_api/models/consent_grant_entity.rb', line 21

def parties
  @parties
end

#resourcesArray[ConsentResourceEntity]

Details of requested or granted resources and data clusters

Returns:



38
39
40
# File 'lib/fdx_v660_api/models/consent_grant_entity.rb', line 38

def resources
  @resources
end

#statusConsentGrantStatus2

The current status of the consent

Returns:



51
52
53
# File 'lib/fdx_v660_api/models/consent_grant_entity.rb', line 51

def status
  @status
end

#updated_timeDateTime

When the consent grant was updated

Returns:

  • (DateTime)


63
64
65
# File 'lib/fdx_v660_api/models/consent_grant_entity.rb', line 63

def updated_time
  @updated_time
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
# File 'lib/fdx_v660_api/models/consent_grant_entity.rb', line 140

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  customer_id = hash.key?('customerId') ? hash['customerId'] : SKIP
  # Parameter is an array, so we need to iterate through it
  parties = nil
  unless hash['parties'].nil?
    parties = []
    hash['parties'].each do |structure|
      parties << (PartyEntity.from_hash(structure) if structure)
    end
  end

  parties = SKIP unless hash.key?('parties')
  duration_type = hash.key?('durationType') ? hash['durationType'] : SKIP
  duration_period =
    hash.key?('durationPeriod') ? hash['durationPeriod'] : SKIP
  lookback_period =
    hash.key?('lookbackPeriod') ? hash['lookbackPeriod'] : SKIP
  # Parameter is an array, so we need to iterate through it
  resources = nil
  unless hash['resources'].nil?
    resources = []
    hash['resources'].each do |structure|
      resources << (ConsentResourceEntity.from_hash(structure) if structure)
    end
  end

  resources = SKIP unless hash.key?('resources')
  if hash['accountSelectionFilters']
     = AccountSelectionFilters1.from_hash(hash['accountSelectionFilters'])
  end
  id = hash.key?('id') ? hash['id'] : SKIP
  status = hash.key?('status') ? hash['status'] : SKIP
  created_time = if hash.key?('createdTime')
                   (DateTimeHelper.from_rfc3339(hash['createdTime']) if hash['createdTime'])
                 else
                   SKIP
                 end
  expiration_time = if hash.key?('expirationTime')
                      (DateTimeHelper.from_rfc3339(hash['expirationTime']) if hash['expirationTime'])
                    else
                      SKIP
                    end
  updated_time = if hash.key?('updatedTime')
                   (DateTimeHelper.from_rfc3339(hash['updatedTime']) if hash['updatedTime'])
                 else
                   SKIP
                 end
  # Parameter is an array, so we need to iterate through it
  links = nil
  unless hash['links'].nil?
    links = []
    hash['links'].each do |structure|
      links << (HateoasLink.from_hash(structure) if structure)
    end
  end

  links = SKIP unless hash.key?('links')

  # 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.
  ConsentGrantEntity.new(customer_id: customer_id,
                         parties: parties,
                         duration_type: duration_type,
                         duration_period: duration_period,
                         lookback_period: lookback_period,
                         resources: resources,
                         account_selection_filters: ,
                         id: id,
                         status: status,
                         created_time: created_time,
                         expiration_time: expiration_time,
                         updated_time: updated_time,
                         links: links,
                         additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/fdx_v660_api/models/consent_grant_entity.rb', line 70

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['customer_id'] = 'customerId'
  @_hash['parties'] = 'parties'
  @_hash['duration_type'] = 'durationType'
  @_hash['duration_period'] = 'durationPeriod'
  @_hash['lookback_period'] = 'lookbackPeriod'
  @_hash['resources'] = 'resources'
  @_hash['account_selection_filters'] = 'accountSelectionFilters'
  @_hash['id'] = 'id'
  @_hash['status'] = 'status'
  @_hash['created_time'] = 'createdTime'
  @_hash['expiration_time'] = 'expirationTime'
  @_hash['updated_time'] = 'updatedTime'
  @_hash['links'] = 'links'
  @_hash
end

.nullablesObject

An array for nullable fields



108
109
110
# File 'lib/fdx_v660_api/models/consent_grant_entity.rb', line 108

def self.nullables
  []
end

.optionalsObject

An array for optional fields



89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# File 'lib/fdx_v660_api/models/consent_grant_entity.rb', line 89

def self.optionals
  %w[
    customer_id
    parties
    duration_type
    duration_period
    lookback_period
    resources
    account_selection_filters
    id
    status
    created_time
    expiration_time
    updated_time
    links
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



249
250
251
252
253
254
255
256
257
258
# File 'lib/fdx_v660_api/models/consent_grant_entity.rb', line 249

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} customer_id: #{@customer_id.inspect}, parties: #{@parties.inspect},"\
  " duration_type: #{@duration_type.inspect}, duration_period: #{@duration_period.inspect},"\
  " lookback_period: #{@lookback_period.inspect}, resources: #{@resources.inspect},"\
  " account_selection_filters: #{@account_selection_filters.inspect}, id: #{@id.inspect},"\
  " status: #{@status.inspect}, created_time: #{@created_time.inspect}, expiration_time:"\
  " #{@expiration_time.inspect}, updated_time: #{@updated_time.inspect}, links:"\
  " #{@links.inspect}, additional_properties: #{@additional_properties}>"
end

#to_custom_created_timeObject



225
226
227
# File 'lib/fdx_v660_api/models/consent_grant_entity.rb', line 225

def to_custom_created_time
  DateTimeHelper.to_rfc3339(created_time)
end

#to_custom_expiration_timeObject



229
230
231
# File 'lib/fdx_v660_api/models/consent_grant_entity.rb', line 229

def to_custom_expiration_time
  DateTimeHelper.to_rfc3339(expiration_time)
end

#to_custom_updated_timeObject



233
234
235
# File 'lib/fdx_v660_api/models/consent_grant_entity.rb', line 233

def to_custom_updated_time
  DateTimeHelper.to_rfc3339(updated_time)
end

#to_sObject

Provides a human-readable string representation of the object.



238
239
240
241
242
243
244
245
246
# File 'lib/fdx_v660_api/models/consent_grant_entity.rb', line 238

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} customer_id: #{@customer_id}, parties: #{@parties}, duration_type:"\
  " #{@duration_type}, duration_period: #{@duration_period}, lookback_period:"\
  " #{@lookback_period}, resources: #{@resources}, account_selection_filters:"\
  " #{@account_selection_filters}, id: #{@id}, status: #{@status}, created_time:"\
  " #{@created_time}, expiration_time: #{@expiration_time}, updated_time: #{@updated_time},"\
  " links: #{@links}, additional_properties: #{@additional_properties}>"
end