Class: VisaAcceptanceMergedSpec::CaptureOptions3

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/visa_acceptance_merged_spec/models/capture_options3.rb

Overview

CaptureOptions3 Model.

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(total_capture_count: SKIP, capture_sequence_number: SKIP, additional_properties: nil) ⇒ CaptureOptions3

Returns a new instance of CaptureOptions3.



55
56
57
58
59
60
61
62
63
# File 'lib/visa_acceptance_merged_spec/models/capture_options3.rb', line 55

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

  @total_capture_count = total_capture_count unless total_capture_count == SKIP
  @capture_sequence_number = capture_sequence_number unless capture_sequence_number == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#capture_sequence_numberInteger

Capture number when requesting multiple partial captures for one authorization. Used along with totalCaptureCount to track which capture is being processed. For example, the second of five captures would be passed to Visa Acceptance as:

- `captureSequenceNumber_ = 2`, and
- `totalCaptureCount = 5`

Returns:

  • (Integer)


32
33
34
# File 'lib/visa_acceptance_merged_spec/models/capture_options3.rb', line 32

def capture_sequence_number
  @capture_sequence_number
end

#total_capture_countInteger

Total number of captures when requesting multiple partial captures for one payment. Used along with captureSequenceNumber field to track which capture is being processed. For example, the second of five captures would be passed to Visa Acceptance as:

- `captureSequenceNumber = 2`, and
- `totalCaptureCount = 5`

Returns:

  • (Integer)


21
22
23
# File 'lib/visa_acceptance_merged_spec/models/capture_options3.rb', line 21

def total_capture_count
  @total_capture_count
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/visa_acceptance_merged_spec/models/capture_options3.rb', line 66

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  total_capture_count =
    hash.key?('totalCaptureCount') ? hash['totalCaptureCount'] : SKIP
  capture_sequence_number =
    hash.key?('captureSequenceNumber') ? hash['captureSequenceNumber'] : SKIP

  # 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.
  CaptureOptions3.new(total_capture_count: total_capture_count,
                      capture_sequence_number: capture_sequence_number,
                      additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



35
36
37
38
39
40
# File 'lib/visa_acceptance_merged_spec/models/capture_options3.rb', line 35

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['total_capture_count'] = 'totalCaptureCount'
  @_hash['capture_sequence_number'] = 'captureSequenceNumber'
  @_hash
end

.nullablesObject

An array for nullable fields



51
52
53
# File 'lib/visa_acceptance_merged_spec/models/capture_options3.rb', line 51

def self.nullables
  []
end

.optionalsObject

An array for optional fields



43
44
45
46
47
48
# File 'lib/visa_acceptance_merged_spec/models/capture_options3.rb', line 43

def self.optionals
  %w[
    total_capture_count
    capture_sequence_number
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



96
97
98
99
100
101
# File 'lib/visa_acceptance_merged_spec/models/capture_options3.rb', line 96

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

#to_sObject

Provides a human-readable string representation of the object.



89
90
91
92
93
# File 'lib/visa_acceptance_merged_spec/models/capture_options3.rb', line 89

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