Class: ThePlaidApi::PaymentConsentValidDateTime

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

Overview

Life span for the payment consent. After the ‘to` date the payment consent expires and can no longer be used for payment initiation.

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(from: SKIP, to: SKIP, additional_properties: nil) ⇒ PaymentConsentValidDateTime

Returns a new instance of PaymentConsentValidDateTime.



48
49
50
51
52
53
54
55
# File 'lib/the_plaid_api/models/payment_consent_valid_date_time.rb', line 48

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

  @from = from unless from == SKIP
  @to = to unless to == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#fromDateTime

The date and time from which the consent should be active, in [ISO 8601](wikipedia.org/wiki/ISO_8601) format.

Returns:

  • (DateTime)


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

def from
  @from
end

#toDateTime

The date and time at which the consent expires, in [ISO 8601](wikipedia.org/wiki/ISO_8601) format.

Returns:

  • (DateTime)


22
23
24
# File 'lib/the_plaid_api/models/payment_consent_valid_date_time.rb', line 22

def to
  @to
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/the_plaid_api/models/payment_consent_valid_date_time.rb', line 58

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  from = if hash.key?('from')
           (DateTimeHelper.from_rfc3339(hash['from']) if hash['from'])
         else
           SKIP
         end
  to = if hash.key?('to')
         (DateTimeHelper.from_rfc3339(hash['to']) if hash['to'])
       else
         SKIP
       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.
  PaymentConsentValidDateTime.new(from: from,
                                  to: to,
                                  additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



25
26
27
28
29
30
# File 'lib/the_plaid_api/models/payment_consent_valid_date_time.rb', line 25

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['from'] = 'from'
  @_hash['to'] = 'to'
  @_hash
end

.nullablesObject

An array for nullable fields



41
42
43
44
45
46
# File 'lib/the_plaid_api/models/payment_consent_valid_date_time.rb', line 41

def self.nullables
  %w[
    from
    to
  ]
end

.optionalsObject

An array for optional fields



33
34
35
36
37
38
# File 'lib/the_plaid_api/models/payment_consent_valid_date_time.rb', line 33

def self.optionals
  %w[
    from
    to
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



102
103
104
105
106
# File 'lib/the_plaid_api/models/payment_consent_valid_date_time.rb', line 102

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

#to_custom_fromObject



86
87
88
# File 'lib/the_plaid_api/models/payment_consent_valid_date_time.rb', line 86

def to_custom_from
  DateTimeHelper.to_rfc3339(from)
end

#to_custom_toObject



90
91
92
# File 'lib/the_plaid_api/models/payment_consent_valid_date_time.rb', line 90

def to_custom_to
  DateTimeHelper.to_rfc3339(to)
end

#to_sObject

Provides a human-readable string representation of the object.



95
96
97
98
99
# File 'lib/the_plaid_api/models/payment_consent_valid_date_time.rb', line 95

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