Class: CyberSourceMergedSpec::SubscriptionInformation
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- CyberSourceMergedSpec::SubscriptionInformation
- Defined in:
- lib/cyber_source_merged_spec/models/subscription_information.rb
Overview
SubscriptionInformation Model.
Instance Attribute Summary collapse
-
#code ⇒ String
Subscription code is an optional field, If not provided system generates and assign one.
-
#name ⇒ String
Subscription Name.
-
#original_transaction_authorized_amount ⇒ String
Amount of the original subscription-initializing payment.
-
#original_transaction_id ⇒ String
Network transaction identifier that was returned in the payment response field processorInformation.transactionId in the reply message for the original subscription-initializing payment.
-
#plan_id ⇒ String
Plan Id.
-
#start_date ⇒ String
Start date of the Subscription Start date must be in UTC.
Class Method Summary collapse
- .from_element(root) ⇒ Object
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(name:, start_date:, code: SKIP, plan_id: SKIP, original_transaction_id: SKIP, original_transaction_authorized_amount: SKIP, additional_properties: nil) ⇒ SubscriptionInformation
constructor
A new instance of SubscriptionInformation.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
- #to_xml_element(doc, root_name) ⇒ Object
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(name:, start_date:, code: SKIP, plan_id: SKIP, original_transaction_id: SKIP, original_transaction_authorized_amount: SKIP, additional_properties: nil) ⇒ SubscriptionInformation
Returns a new instance of SubscriptionInformation.
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/cyber_source_merged_spec/models/subscription_information.rb', line 74 def initialize(name:, start_date:, code: SKIP, plan_id: SKIP, original_transaction_id: SKIP, original_transaction_authorized_amount: 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 @start_date = start_date @original_transaction_id = original_transaction_id unless original_transaction_id == SKIP unless == SKIP @original_transaction_authorized_amount = end @additional_properties = additional_properties end |
Instance Attribute Details
#code ⇒ String
Subscription code is an optional field, If not provided system generates and assign one
15 16 17 |
# File 'lib/cyber_source_merged_spec/models/subscription_information.rb', line 15 def code @code end |
#name ⇒ String
Subscription Name
23 24 25 |
# File 'lib/cyber_source_merged_spec/models/subscription_information.rb', line 23 def name @name end |
#original_transaction_authorized_amount ⇒ String
Amount of the original subscription-initializing payment. Required when using a Diners or Discover card.
44 45 46 |
# File 'lib/cyber_source_merged_spec/models/subscription_information.rb', line 44 def @original_transaction_authorized_amount end |
#original_transaction_id ⇒ String
Network transaction identifier that was returned in the payment response field processorInformation.transactionId in the reply message for the original subscription-initializing payment.
39 40 41 |
# File 'lib/cyber_source_merged_spec/models/subscription_information.rb', line 39 def original_transaction_id @original_transaction_id end |
#plan_id ⇒ String
Plan Id. Use Plan Id from Create Plan Service.
19 20 21 |
# File 'lib/cyber_source_merged_spec/models/subscription_information.rb', line 19 def plan_id @plan_id end |
#start_date ⇒ String
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.
33 34 35 |
# File 'lib/cyber_source_merged_spec/models/subscription_information.rb', line 33 def start_date @start_date end |
Class Method Details
.from_element(root) ⇒ Object
124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 |
# File 'lib/cyber_source_merged_spec/models/subscription_information.rb', line 124 def self.from_element(root) name = XmlUtilities.from_element(root, 'name', String) start_date = XmlUtilities.from_element(root, 'startDate', String) code = XmlUtilities.from_element(root, 'code', String) plan_id = XmlUtilities.from_element(root, 'planId', String) original_transaction_id = XmlUtilities.from_element( root, 'originalTransactionId', String ) = XmlUtilities.from_element( root, 'originalTransactionAuthorizedAmount', String ) new(name: name, start_date: start_date, code: code, plan_id: plan_id, original_transaction_id: original_transaction_id, original_transaction_authorized_amount: , additional_properties: additional_properties) end |
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
# File 'lib/cyber_source_merged_spec/models/subscription_information.rb', line 94 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. name = hash.key?('name') ? hash['name'] : nil start_date = hash.key?('startDate') ? hash['startDate'] : nil code = hash.key?('code') ? hash['code'] : SKIP plan_id = hash.key?('planId') ? hash['planId'] : SKIP original_transaction_id = hash.key?('originalTransactionId') ? hash['originalTransactionId'] : SKIP = hash.key?('originalTransactionAuthorizedAmount') ? hash['originalTransactionAuthorizedAmount'] : 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. SubscriptionInformation.new(name: name, start_date: start_date, code: code, plan_id: plan_id, original_transaction_id: original_transaction_id, original_transaction_authorized_amount: , additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/cyber_source_merged_spec/models/subscription_information.rb', line 47 def self.names @_hash = {} if @_hash.nil? @_hash['code'] = 'code' @_hash['plan_id'] = 'planId' @_hash['name'] = 'name' @_hash['start_date'] = 'startDate' @_hash['original_transaction_id'] = 'originalTransactionId' @_hash['original_transaction_authorized_amount'] = 'originalTransactionAuthorizedAmount' @_hash end |
.nullables ⇒ Object
An array for nullable fields
70 71 72 |
# File 'lib/cyber_source_merged_spec/models/subscription_information.rb', line 70 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
60 61 62 63 64 65 66 67 |
# File 'lib/cyber_source_merged_spec/models/subscription_information.rb', line 60 def self.optionals %w[ code plan_id original_transaction_id original_transaction_authorized_amount ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
173 174 175 176 177 178 179 180 |
# File 'lib/cyber_source_merged_spec/models/subscription_information.rb', line 173 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}, original_transaction_id:"\ " #{@original_transaction_id.inspect}, original_transaction_authorized_amount:"\ " #{@original_transaction_authorized_amount.inspect}, additional_properties:"\ " #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
164 165 166 167 168 169 170 |
# File 'lib/cyber_source_merged_spec/models/subscription_information.rb', line 164 def to_s class_name = self.class.name.split('::').last "<#{class_name} code: #{@code}, plan_id: #{@plan_id}, name: #{@name}, start_date:"\ " #{@start_date}, original_transaction_id: #{@original_transaction_id},"\ " original_transaction_authorized_amount: #{@original_transaction_authorized_amount},"\ " additional_properties: #{@additional_properties}>" end |
#to_xml_element(doc, root_name) ⇒ Object
145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 |
# File 'lib/cyber_source_merged_spec/models/subscription_information.rb', line 145 def to_xml_element(doc, root_name) root = doc.create_element(root_name) XmlUtilities.add_as_subelement(doc, root, 'name', name) XmlUtilities.add_as_subelement(doc, root, 'startDate', start_date) XmlUtilities.add_as_subelement(doc, root, 'code', code) XmlUtilities.add_as_subelement(doc, root, 'planId', plan_id) XmlUtilities.add_as_subelement(doc, root, 'originalTransactionId', original_transaction_id) XmlUtilities.add_as_subelement(doc, root, 'originalTransactionAuthorizedAmount', ) XmlUtilities.add_as_subelement(doc, root, 'additional_properties', additional_properties) root end |