Class: CyberSourceMergedSpec::PlanInformation4
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- CyberSourceMergedSpec::PlanInformation4
- Defined in:
- lib/cyber_source_merged_spec/models/plan_information4.rb
Overview
PlanInformation4 Model.
Instance Attribute Summary collapse
-
#billing_cycles ⇒ BillingCycles
Number of times customer is going to be billed.
-
#billing_period ⇒ BillingPeriod
Billing Frequency.
-
#code ⇒ String
Plan code is an optional field, If not provided system generates and assign one.
-
#description ⇒ String
Plan description.
-
#name ⇒ String
Plan name.
-
#status ⇒ String
Updating to
DRAFTis not allowed fromACTIVEandINACTIVEstatus.
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(code: SKIP, name: SKIP, description: SKIP, status: SKIP, billing_period: SKIP, billing_cycles: SKIP, additional_properties: nil) ⇒ PlanInformation4
constructor
A new instance of PlanInformation4.
-
#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(code: SKIP, name: SKIP, description: SKIP, status: SKIP, billing_period: SKIP, billing_cycles: SKIP, additional_properties: nil) ⇒ PlanInformation4
Returns a new instance of PlanInformation4.
70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/cyber_source_merged_spec/models/plan_information4.rb', line 70 def initialize(code: SKIP, name: SKIP, description: SKIP, status: SKIP, billing_period: SKIP, billing_cycles: SKIP, additional_properties: nil) # Add additional model properties to the instance additional_properties = {} if additional_properties.nil? @code = code unless code == SKIP @name = name unless name == SKIP @description = description unless description == SKIP @status = status unless status == SKIP @billing_period = billing_period unless billing_period == SKIP @billing_cycles = billing_cycles unless billing_cycles == SKIP @additional_properties = additional_properties end |
Instance Attribute Details
#billing_cycles ⇒ BillingCycles
Number of times customer is going to be billed
39 40 41 |
# File 'lib/cyber_source_merged_spec/models/plan_information4.rb', line 39 def billing_cycles @billing_cycles end |
#billing_period ⇒ BillingPeriod
Billing Frequency
35 36 37 |
# File 'lib/cyber_source_merged_spec/models/plan_information4.rb', line 35 def billing_period @billing_period end |
#code ⇒ String
Plan code is an optional field, If not provided system generates and assign one
15 16 17 |
# File 'lib/cyber_source_merged_spec/models/plan_information4.rb', line 15 def code @code end |
#description ⇒ String
Plan description
23 24 25 |
# File 'lib/cyber_source_merged_spec/models/plan_information4.rb', line 23 def description @description end |
#name ⇒ String
Plan name
19 20 21 |
# File 'lib/cyber_source_merged_spec/models/plan_information4.rb', line 19 def name @name end |
#status ⇒ String
Updating to DRAFT is not allowed from ACTIVE and INACTIVE status.
Plan Status:
DRAFTACTIVEINACTIVE
31 32 33 |
# File 'lib/cyber_source_merged_spec/models/plan_information4.rb', line 31 def status @status end |
Class Method Details
.from_element(root) ⇒ Object
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 |
# File 'lib/cyber_source_merged_spec/models/plan_information4.rb', line 114 def self.from_element(root) code = XmlUtilities.from_element(root, 'code', String) name = XmlUtilities.from_element(root, 'name', String) description = XmlUtilities.from_element(root, 'description', String) status = XmlUtilities.from_element(root, 'status', String) billing_period = XmlUtilities.from_element(root, 'BillingPeriod', BillingPeriod) billing_cycles = XmlUtilities.from_element(root, 'BillingCycles', BillingCycles) new(code: code, name: name, description: description, status: status, billing_period: billing_period, billing_cycles: billing_cycles, additional_properties: additional_properties) end |
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'lib/cyber_source_merged_spec/models/plan_information4.rb', line 86 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. code = hash.key?('code') ? hash['code'] : SKIP name = hash.key?('name') ? hash['name'] : SKIP description = hash.key?('description') ? hash['description'] : SKIP status = hash.key?('status') ? hash['status'] : SKIP billing_period = BillingPeriod.from_hash(hash['billingPeriod']) if hash['billingPeriod'] billing_cycles = BillingCycles.from_hash(hash['billingCycles']) if hash['billingCycles'] # 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. PlanInformation4.new(code: code, name: name, description: description, status: status, billing_period: billing_period, billing_cycles: billing_cycles, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
42 43 44 45 46 47 48 49 50 51 |
# File 'lib/cyber_source_merged_spec/models/plan_information4.rb', line 42 def self.names @_hash = {} if @_hash.nil? @_hash['code'] = 'code' @_hash['name'] = 'name' @_hash['description'] = 'description' @_hash['status'] = 'status' @_hash['billing_period'] = 'billingPeriod' @_hash['billing_cycles'] = 'billingCycles' @_hash end |
.nullables ⇒ Object
An array for nullable fields
66 67 68 |
# File 'lib/cyber_source_merged_spec/models/plan_information4.rb', line 66 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
54 55 56 57 58 59 60 61 62 63 |
# File 'lib/cyber_source_merged_spec/models/plan_information4.rb', line 54 def self.optionals %w[ code name description status billing_period billing_cycles ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
157 158 159 160 161 162 163 |
# File 'lib/cyber_source_merged_spec/models/plan_information4.rb', line 157 def inspect class_name = self.class.name.split('::').last "<#{class_name} code: #{@code.inspect}, name: #{@name.inspect}, description:"\ " #{@description.inspect}, status: #{@status.inspect}, billing_period:"\ " #{@billing_period.inspect}, billing_cycles: #{@billing_cycles.inspect},"\ " additional_properties: #{@additional_properties}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
149 150 151 152 153 154 |
# File 'lib/cyber_source_merged_spec/models/plan_information4.rb', line 149 def to_s class_name = self.class.name.split('::').last "<#{class_name} code: #{@code}, name: #{@name}, description: #{@description}, status:"\ " #{@status}, billing_period: #{@billing_period}, billing_cycles: #{@billing_cycles},"\ " additional_properties: #{@additional_properties}>" end |
#to_xml_element(doc, root_name) ⇒ Object
133 134 135 136 137 138 139 140 141 142 143 144 145 146 |
# File 'lib/cyber_source_merged_spec/models/plan_information4.rb', line 133 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, 'name', name) XmlUtilities.add_as_subelement(doc, root, 'description', description) XmlUtilities.add_as_subelement(doc, root, 'status', status) XmlUtilities.add_as_subelement(doc, root, 'BillingPeriod', billing_period) XmlUtilities.add_as_subelement(doc, root, 'BillingCycles', billing_cycles) XmlUtilities.add_as_subelement(doc, root, 'additional_properties', additional_properties) root end |