Class: CyberSourceMergedSpec::SubscriptionInformation2

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

Overview

SubscriptionInformation2 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(code: SKIP, plan_id: SKIP, name: SKIP, start_date: SKIP, status: SKIP, additional_properties: nil) ⇒ SubscriptionInformation2

Returns a new instance of SubscriptionInformation2.



70
71
72
73
74
75
76
77
78
79
80
81
# File 'lib/cyber_source_merged_spec/models/subscription_information2.rb', line 70

def initialize(code: SKIP, plan_id: SKIP, name: SKIP, start_date: SKIP,
               status: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @code = code unless code == SKIP
  @plan_id = plan_id unless plan_id == SKIP
  @name = name unless name == SKIP
  @start_date = start_date unless start_date == SKIP
  @status = status unless status == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#codeString

Subscription code.

Returns:

  • (String)


14
15
16
# File 'lib/cyber_source_merged_spec/models/subscription_information2.rb', line 14

def code
  @code
end

#nameString

Subscription Name

Returns:

  • (String)


22
23
24
# File 'lib/cyber_source_merged_spec/models/subscription_information2.rb', line 22

def name
  @name
end

#plan_idString

Plan Id.

Returns:

  • (String)


18
19
20
# File 'lib/cyber_source_merged_spec/models/subscription_information2.rb', line 18

def plan_id
  @plan_id
end

#start_dateString

Start date of the Subscription Start date will be in UTC. Format: YYYY-MM-DDThh:mm:ssZ The T separates the date and the time. The Z indicates UTC. Example 2022-08-11T22:47:57Z equals August 11, 2022, at 22:47:57 (10:47:57 p.m.).

Returns:

  • (String)


30
31
32
# File 'lib/cyber_source_merged_spec/models/subscription_information2.rb', line 30

def start_date
  @start_date
end

#statusString

Subscription Status:

  • PENDING
  • ACTIVE
  • FAILED
  • COMPLETED
  • DELINQUENT
  • SUSPENDED
  • CANCELLED

Returns:

  • (String)


41
42
43
# File 'lib/cyber_source_merged_spec/models/subscription_information2.rb', line 41

def status
  @status
end

Class Method Details

.from_element(root) ⇒ Object



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

def self.from_element(root)
  code = XmlUtilities.from_element(root, 'code', String)
  plan_id = XmlUtilities.from_element(root, 'planId', String)
  name = XmlUtilities.from_element(root, 'name', String)
  start_date = XmlUtilities.from_element(root, 'startDate', String)
  status = XmlUtilities.from_element(root, 'status', String)

  new(code: code,
      plan_id: plan_id,
      name: name,
      start_date: start_date,
      status: status,
      additional_properties: additional_properties)
end

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/cyber_source_merged_spec/models/subscription_information2.rb', line 84

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  code = hash.key?('code') ? hash['code'] : SKIP
  plan_id = hash.key?('planId') ? hash['planId'] : SKIP
  name = hash.key?('name') ? hash['name'] : SKIP
  start_date = hash.key?('startDate') ? hash['startDate'] : SKIP
  status = hash.key?('status') ? hash['status'] : 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.
  SubscriptionInformation2.new(code: code,
                               plan_id: plan_id,
                               name: name,
                               start_date: start_date,
                               status: status,
                               additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



44
45
46
47
48
49
50
51
52
# File 'lib/cyber_source_merged_spec/models/subscription_information2.rb', line 44

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['code'] = 'code'
  @_hash['plan_id'] = 'planId'
  @_hash['name'] = 'name'
  @_hash['start_date'] = 'startDate'
  @_hash['status'] = 'status'
  @_hash
end

.nullablesObject

An array for nullable fields



66
67
68
# File 'lib/cyber_source_merged_spec/models/subscription_information2.rb', line 66

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    code
    plan_id
    name
    start_date
    status
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



147
148
149
150
151
152
# File 'lib/cyber_source_merged_spec/models/subscription_information2.rb', line 147

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

#to_sObject

Provides a human-readable string representation of the object.



140
141
142
143
144
# File 'lib/cyber_source_merged_spec/models/subscription_information2.rb', line 140

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

#to_xml_element(doc, root_name) ⇒ Object



125
126
127
128
129
130
131
132
133
134
135
136
137
# File 'lib/cyber_source_merged_spec/models/subscription_information2.rb', line 125

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

  XmlUtilities.add_as_subelement(doc, root, 'code', code)
  XmlUtilities.add_as_subelement(doc, root, 'planId', plan_id)
  XmlUtilities.add_as_subelement(doc, root, 'name', name)
  XmlUtilities.add_as_subelement(doc, root, 'startDate', start_date)
  XmlUtilities.add_as_subelement(doc, root, 'status', status)
  XmlUtilities.add_as_subelement(doc, root, 'additional_properties',
                                 additional_properties)

  root
end