Class: CyberSourceMergedSpec::PlanInformation
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- CyberSourceMergedSpec::PlanInformation
- Defined in:
- lib/cyber_source_merged_spec/models/plan_information.rb
Overview
PlanInformation 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
Plan Status: -
DRAFT-ACTIVE(default).
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:, billing_period:, code: SKIP, description: SKIP, status: SKIP, billing_cycles: SKIP, additional_properties: nil) ⇒ PlanInformation
constructor
A new instance of PlanInformation.
-
#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:, billing_period:, code: SKIP, description: SKIP, status: SKIP, billing_cycles: SKIP, additional_properties: nil) ⇒ PlanInformation
Returns a new instance of PlanInformation.
66 67 68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/cyber_source_merged_spec/models/plan_information.rb', line 66 def initialize(name:, billing_period:, code: SKIP, description: SKIP, status: 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 @description = description unless description == SKIP @status = status unless status == SKIP @billing_period = billing_period @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
37 38 39 |
# File 'lib/cyber_source_merged_spec/models/plan_information.rb', line 37 def billing_cycles @billing_cycles end |
#billing_period ⇒ BillingPeriod
Billing Frequency
33 34 35 |
# File 'lib/cyber_source_merged_spec/models/plan_information.rb', line 33 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_information.rb', line 15 def code @code end |
#description ⇒ String
Plan description
23 24 25 |
# File 'lib/cyber_source_merged_spec/models/plan_information.rb', line 23 def description @description end |
#name ⇒ String
Plan name
19 20 21 |
# File 'lib/cyber_source_merged_spec/models/plan_information.rb', line 19 def name @name end |
#status ⇒ String
Plan Status:
DRAFTACTIVE(default)
29 30 31 |
# File 'lib/cyber_source_merged_spec/models/plan_information.rb', line 29 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 124 125 126 127 |
# File 'lib/cyber_source_merged_spec/models/plan_information.rb', line 110 def self.from_element(root) name = XmlUtilities.from_element(root, 'name', String) billing_period = XmlUtilities.from_element(root, 'BillingPeriod', BillingPeriod) code = XmlUtilities.from_element(root, 'code', String) description = XmlUtilities.from_element(root, 'description', String) status = XmlUtilities.from_element(root, 'status', String) billing_cycles = XmlUtilities.from_element(root, 'BillingCycles', BillingCycles) new(name: name, billing_period: billing_period, code: code, description: description, status: status, billing_cycles: billing_cycles, additional_properties: additional_properties) end |
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
82 83 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/plan_information.rb', line 82 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. name = hash.key?('name') ? hash['name'] : nil billing_period = BillingPeriod.from_hash(hash['billingPeriod']) if hash['billingPeriod'] code = hash.key?('code') ? hash['code'] : SKIP description = hash.key?('description') ? hash['description'] : SKIP status = hash.key?('status') ? hash['status'] : SKIP 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. PlanInformation.new(name: name, billing_period: billing_period, code: code, description: description, status: status, billing_cycles: billing_cycles, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
40 41 42 43 44 45 46 47 48 49 |
# File 'lib/cyber_source_merged_spec/models/plan_information.rb', line 40 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
62 63 64 |
# File 'lib/cyber_source_merged_spec/models/plan_information.rb', line 62 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
52 53 54 55 56 57 58 59 |
# File 'lib/cyber_source_merged_spec/models/plan_information.rb', line 52 def self.optionals %w[ code description status billing_cycles ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
153 154 155 156 157 158 159 |
# File 'lib/cyber_source_merged_spec/models/plan_information.rb', line 153 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.
145 146 147 148 149 150 |
# File 'lib/cyber_source_merged_spec/models/plan_information.rb', line 145 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
129 130 131 132 133 134 135 136 137 138 139 140 141 142 |
# File 'lib/cyber_source_merged_spec/models/plan_information.rb', line 129 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, 'BillingPeriod', billing_period) XmlUtilities.add_as_subelement(doc, root, 'code', code) XmlUtilities.add_as_subelement(doc, root, 'description', description) XmlUtilities.add_as_subelement(doc, root, 'status', status) XmlUtilities.add_as_subelement(doc, root, 'BillingCycles', billing_cycles) XmlUtilities.add_as_subelement(doc, root, 'additional_properties', additional_properties) root end |