Class: CyberSourceMergedSpec::SubscriptionInformation4

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

Overview

SubscriptionInformation4 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, additional_properties: nil) ⇒ SubscriptionInformation4

Returns a new instance of SubscriptionInformation4.



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

def initialize(code: SKIP, plan_id: SKIP, name: SKIP, start_date: 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
  @additional_properties = additional_properties
end

Instance Attribute Details

#codeString

Subscription code is an optional field, If not provided system generates and assign one

Returns:

  • (String)


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

def code
  @code
end

#nameString

Subscription Name

Returns:

  • (String)


23
24
25
# File 'lib/cyber_source_merged_spec/models/subscription_information4.rb', line 23

def name
  @name
end

#plan_idString

Plan Id. Use Plan Id from Create Plan Service.

Returns:

  • (String)


19
20
21
# File 'lib/cyber_source_merged_spec/models/subscription_information4.rb', line 19

def plan_id
  @plan_id
end

#start_dateString

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

Returns:

  • (String)


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

def start_date
  @start_date
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/subscription_information4.rb', line 97

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)

  new(code: code,
      plan_id: plan_id,
      name: name,
      start_date: start_date,
      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/subscription_information4.rb', line 73

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

  # 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.
  SubscriptionInformation4.new(code: code,
                               plan_id: plan_id,
                               name: name,
                               start_date: start_date,
                               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/subscription_information4.rb', line 36

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

.nullablesObject

An array for nullable fields



56
57
58
# File 'lib/cyber_source_merged_spec/models/subscription_information4.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/subscription_information4.rb', line 46

def self.optionals
  %w[
    code
    plan_id
    name
    start_date
  ]
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/subscription_information4.rb', line 131

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}, 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/subscription_information4.rb', line 124

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} code: #{@code}, plan_id: #{@plan_id}, name: #{@name}, start_date:"\
  " #{@start_date}, 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/subscription_information4.rb', line 110

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, 'additional_properties',
                                 additional_properties)

  root
end