Class: CyberSourceMergedSpec::DirectDebit1

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/cyber_source_merged_spec/models/direct_debit1.rb

Overview

DirectDebit1 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(reference: SKIP, signature_date: SKIP, url: SKIP, type: SKIP, additional_properties: nil) ⇒ DirectDebit1

Returns a new instance of DirectDebit1.



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

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

  @reference = reference unless reference == SKIP
  @signature_date = signature_date unless signature_date == SKIP
  @url = url unless url == SKIP
  @type = type unless type == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#referenceString

Mandate reference as returned on the first transaction in the sequence

Returns:

  • (String)


15
16
17
# File 'lib/cyber_source_merged_spec/models/direct_debit1.rb', line 15

def reference
  @reference
end

#signature_dateString

Date of the initial transaction, format is YYYY-MM-DD. Date can be taken from the finaltimestamp of the SUCCEEDED notification for the first transaction in the sequence.

Returns:

  • (String)


21
22
23
# File 'lib/cyber_source_merged_spec/models/direct_debit1.rb', line 21

def signature_date
  @signature_date
end

#typeString

Sequence type of the direct debit, defaults to “oneOff”. Valid values: oneOff The direct debit is executed once. first First direct debit in a series of recurring ones.

Returns:

  • (String)


33
34
35
# File 'lib/cyber_source_merged_spec/models/direct_debit1.rb', line 33

def type
  @type
end

#urlString

Valid URL pointing to the SEPA mandate, needs to be accessible by our risk and compliance department.

Returns:

  • (String)


26
27
28
# File 'lib/cyber_source_merged_spec/models/direct_debit1.rb', line 26

def url
  @url
end

Class Method Details

.from_element(root) ⇒ Object



97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/cyber_source_merged_spec/models/direct_debit1.rb', line 97

def self.from_element(root)
  reference = XmlUtilities.from_element(root, 'reference', String)
  signature_date = XmlUtilities.from_element(root, 'signatureDate', String)
  url = XmlUtilities.from_element(root, 'url', String)
  type = XmlUtilities.from_element(root, 'type', String)

  new(reference: reference,
      signature_date: signature_date,
      url: url,
      type: type,
      additional_properties: additional_properties)
end

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/cyber_source_merged_spec/models/direct_debit1.rb', line 73

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  reference = hash.key?('reference') ? hash['reference'] : SKIP
  signature_date = hash.key?('signatureDate') ? hash['signatureDate'] : SKIP
  url = hash.key?('url') ? hash['url'] : SKIP
  type = hash.key?('type') ? hash['type'] : 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.
  DirectDebit1.new(reference: reference,
                   signature_date: signature_date,
                   url: url,
                   type: type,
                   additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



36
37
38
39
40
41
42
43
# File 'lib/cyber_source_merged_spec/models/direct_debit1.rb', line 36

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['reference'] = 'reference'
  @_hash['signature_date'] = 'signatureDate'
  @_hash['url'] = 'url'
  @_hash['type'] = 'type'
  @_hash
end

.nullablesObject

An array for nullable fields



56
57
58
# File 'lib/cyber_source_merged_spec/models/direct_debit1.rb', line 56

def self.nullables
  []
end

.optionalsObject

An array for optional fields



46
47
48
49
50
51
52
53
# File 'lib/cyber_source_merged_spec/models/direct_debit1.rb', line 46

def self.optionals
  %w[
    reference
    signature_date
    url
    type
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



131
132
133
134
135
136
# File 'lib/cyber_source_merged_spec/models/direct_debit1.rb', line 131

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

#to_sObject

Provides a human-readable string representation of the object.



124
125
126
127
128
# File 'lib/cyber_source_merged_spec/models/direct_debit1.rb', line 124

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

#to_xml_element(doc, root_name) ⇒ Object



110
111
112
113
114
115
116
117
118
119
120
121
# File 'lib/cyber_source_merged_spec/models/direct_debit1.rb', line 110

def to_xml_element(doc, root_name)
  root = doc.create_element(root_name)

  XmlUtilities.add_as_subelement(doc, root, 'reference', reference)
  XmlUtilities.add_as_subelement(doc, root, 'signatureDate', signature_date)
  XmlUtilities.add_as_subelement(doc, root, 'url', url)
  XmlUtilities.add_as_subelement(doc, root, 'type', type)
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end