Class: FdxV660Api::ConsentRequestEntity

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

Overview

Details of request to create new consent grant. This schema is to be used in POST request to Data Provider's 'POST /consents' or POST /par endpoint using the Pushed Authorization Request (PAR) method

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, additional_properties: nil) ⇒ ConsentRequestEntity

Returns a new instance of ConsentRequestEntity.



77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/fdx_v660_api/models/consent_request_entity.rb', line 77

def initialize(customer_id: SKIP, parties: SKIP, duration_type: SKIP,
               duration_period: SKIP, lookback_period: SKIP,
               resources: SKIP, account_selection_filters: 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
  @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



44
45
46
# File 'lib/fdx_v660_api/models/consent_request_entity.rb', line 44

def 
  @account_selection_filters
end

#customer_idString

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

Returns:

  • (String)


17
18
19
# File 'lib/fdx_v660_api/models/consent_request_entity.rb', line 17

def customer_id
  @customer_id
end

#duration_periodInteger

The consent duration in days from day of original grant

Returns:

  • (Integer)


30
31
32
# File 'lib/fdx_v660_api/models/consent_request_entity.rb', line 30

def duration_period
  @duration_period
end

#duration_typeConsentDurationType2

The type of duration of the consent



26
27
28
# File 'lib/fdx_v660_api/models/consent_request_entity.rb', line 26

def duration_type
  @duration_type
end

#lookback_periodInteger

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

Returns:

  • (Integer)


35
36
37
# File 'lib/fdx_v660_api/models/consent_request_entity.rb', line 35

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:



22
23
24
# File 'lib/fdx_v660_api/models/consent_request_entity.rb', line 22

def parties
  @parties
end

#resourcesArray[ConsentResourceEntity]

Details of requested or granted resources and data clusters

Returns:



39
40
41
# File 'lib/fdx_v660_api/models/consent_request_entity.rb', line 39

def resources
  @resources
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



98
99
100
101
102
103
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
140
141
142
143
144
145
146
147
148
# File 'lib/fdx_v660_api/models/consent_request_entity.rb', line 98

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

  # 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.
  ConsentRequestEntity.new(customer_id: customer_id,
                           parties: parties,
                           duration_type: duration_type,
                           duration_period: duration_period,
                           lookback_period: lookback_period,
                           resources: resources,
                           account_selection_filters: ,
                           additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



47
48
49
50
51
52
53
54
55
56
57
# File 'lib/fdx_v660_api/models/consent_request_entity.rb', line 47

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
end

.nullablesObject

An array for nullable fields



73
74
75
# File 'lib/fdx_v660_api/models/consent_request_entity.rb', line 73

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    customer_id
    parties
    duration_type
    duration_period
    lookback_period
    resources
    account_selection_filters
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



160
161
162
163
164
165
166
167
# File 'lib/fdx_v660_api/models/consent_request_entity.rb', line 160

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}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



151
152
153
154
155
156
157
# File 'lib/fdx_v660_api/models/consent_request_entity.rb', line 151

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}, additional_properties: #{@additional_properties}>"
end