Class: CyberSourceMergedSpec::PlanInformation9
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- CyberSourceMergedSpec::PlanInformation9
- Defined in:
- lib/cyber_source_merged_spec/models/plan_information9.rb
Overview
PlanInformation9 Model.
Instance Attribute Summary collapse
-
#billing_cycles ⇒ BillingCycles5
Billing Frequency.
-
#billing_period ⇒ BillingPeriod
Billing Frequency.
-
#code ⇒ String
Plan code.
-
#name ⇒ String
Plan name.
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, billing_period: SKIP, billing_cycles: SKIP, additional_properties: nil) ⇒ PlanInformation9
constructor
A new instance of PlanInformation9.
-
#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, billing_period: SKIP, billing_cycles: SKIP, additional_properties: nil) ⇒ PlanInformation9
Returns a new instance of PlanInformation9.
53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/cyber_source_merged_spec/models/plan_information9.rb', line 53 def initialize(code: SKIP, name: 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 @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 ⇒ BillingCycles5
Billing Frequency
26 27 28 |
# File 'lib/cyber_source_merged_spec/models/plan_information9.rb', line 26 def billing_cycles @billing_cycles end |
#billing_period ⇒ BillingPeriod
Billing Frequency
22 23 24 |
# File 'lib/cyber_source_merged_spec/models/plan_information9.rb', line 22 def billing_period @billing_period end |
#code ⇒ String
Plan code
14 15 16 |
# File 'lib/cyber_source_merged_spec/models/plan_information9.rb', line 14 def code @code end |
#name ⇒ String
Plan name
18 19 20 |
# File 'lib/cyber_source_merged_spec/models/plan_information9.rb', line 18 def name @name end |
Class Method Details
.from_element(root) ⇒ Object
90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
# File 'lib/cyber_source_merged_spec/models/plan_information9.rb', line 90 def self.from_element(root) code = XmlUtilities.from_element(root, 'code', String) name = XmlUtilities.from_element(root, 'name', String) billing_period = XmlUtilities.from_element(root, 'BillingPeriod', BillingPeriod) billing_cycles = XmlUtilities.from_element(root, 'BillingCycles5', BillingCycles5) new(code: code, name: name, 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.
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/cyber_source_merged_spec/models/plan_information9.rb', line 66 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 billing_period = BillingPeriod.from_hash(hash['billingPeriod']) if hash['billingPeriod'] billing_cycles = BillingCycles5.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. PlanInformation9.new(code: code, name: name, 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.
29 30 31 32 33 34 35 36 |
# File 'lib/cyber_source_merged_spec/models/plan_information9.rb', line 29 def self.names @_hash = {} if @_hash.nil? @_hash['code'] = 'code' @_hash['name'] = 'name' @_hash['billing_period'] = 'billingPeriod' @_hash['billing_cycles'] = 'billingCycles' @_hash end |
.nullables ⇒ Object
An array for nullable fields
49 50 51 |
# File 'lib/cyber_source_merged_spec/models/plan_information9.rb', line 49 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
39 40 41 42 43 44 45 46 |
# File 'lib/cyber_source_merged_spec/models/plan_information9.rb', line 39 def self.optionals %w[ code name billing_period billing_cycles ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
127 128 129 130 131 132 |
# File 'lib/cyber_source_merged_spec/models/plan_information9.rb', line 127 def inspect class_name = self.class.name.split('::').last "<#{class_name} code: #{@code.inspect}, name: #{@name.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.
120 121 122 123 124 |
# File 'lib/cyber_source_merged_spec/models/plan_information9.rb', line 120 def to_s class_name = self.class.name.split('::').last "<#{class_name} code: #{@code}, name: #{@name}, billing_period: #{@billing_period},"\ " billing_cycles: #{@billing_cycles}, additional_properties: #{@additional_properties}>" end |
#to_xml_element(doc, root_name) ⇒ Object
105 106 107 108 109 110 111 112 113 114 115 116 117 |
# File 'lib/cyber_source_merged_spec/models/plan_information9.rb', line 105 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, 'BillingPeriod', billing_period) XmlUtilities.add_as_subelement(doc, root, 'BillingCycles5', billing_cycles) XmlUtilities.add_as_subelement(doc, root, 'additional_properties', additional_properties) root end |