Class: ThePlaidApi::TransferTestClock

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

Overview

Defines the test clock for a transfer.

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(test_clock_id:, virtual_time:, additional_properties: nil) ⇒ TransferTestClock

Returns a new instance of TransferTestClock.



45
46
47
48
49
50
51
52
# File 'lib/the_plaid_api/models/transfer_test_clock.rb', line 45

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

  @test_clock_id = test_clock_id
  @virtual_time = virtual_time
  @additional_properties = additional_properties
end

Instance Attribute Details

#test_clock_idString

Plaid’s unique identifier for a test clock. This field is only populated in the Sandbox environment, and only if a ‘test_clock_id` was included in the `/transfer/recurring/create` request. For more details, see [Simulating recurring transfers](plaid.com/docs/transfer/sandbox/#simulating-recurring-t ransfers).

Returns:

  • (String)


20
21
22
# File 'lib/the_plaid_api/models/transfer_test_clock.rb', line 20

def test_clock_id
  @test_clock_id
end

#virtual_timeDateTime

The virtual timestamp on the test clock. This will be of the form ‘2006-01-02T15:04:05Z`.

Returns:

  • (DateTime)


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

def virtual_time
  @virtual_time
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/the_plaid_api/models/transfer_test_clock.rb', line 55

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  test_clock_id = hash.key?('test_clock_id') ? hash['test_clock_id'] : nil
  virtual_time = if hash.key?('virtual_time')
                   (DateTimeHelper.from_rfc3339(hash['virtual_time']) if hash['virtual_time'])
                 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.
  TransferTestClock.new(test_clock_id: test_clock_id,
                        virtual_time: virtual_time,
                        additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



28
29
30
31
32
33
# File 'lib/the_plaid_api/models/transfer_test_clock.rb', line 28

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

.nullablesObject

An array for nullable fields



41
42
43
# File 'lib/the_plaid_api/models/transfer_test_clock.rb', line 41

def self.nullables
  []
end

.optionalsObject

An array for optional fields



36
37
38
# File 'lib/the_plaid_api/models/transfer_test_clock.rb', line 36

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



89
90
91
92
93
# File 'lib/the_plaid_api/models/transfer_test_clock.rb', line 89

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

#to_custom_virtual_timeObject



77
78
79
# File 'lib/the_plaid_api/models/transfer_test_clock.rb', line 77

def to_custom_virtual_time
  DateTimeHelper.to_rfc3339(virtual_time)
end

#to_sObject

Provides a human-readable string representation of the object.



82
83
84
85
86
# File 'lib/the_plaid_api/models/transfer_test_clock.rb', line 82

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