Class: PaypalServerSdk::PlanCollection
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- PaypalServerSdk::PlanCollection
- Defined in:
- lib/paypal_server_sdk/models/plan_collection.rb
Overview
The list of plans with details.
Instance Attribute Summary collapse
-
#links ⇒ Array[LinkDescription]
An array of request-related [HATEOAS links](/docs/api/reference/api-responses/#hateoas-links).
-
#plans ⇒ Array[BillingPlan]
An array of plans.
-
#total_items ⇒ Integer
The total number of items.
-
#total_pages ⇒ Integer
The total number of pages.
Class Method Summary collapse
-
.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(plans: SKIP, total_items: SKIP, total_pages: SKIP, links: SKIP) ⇒ PlanCollection
constructor
A new instance of PlanCollection.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the 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(plans: SKIP, total_items: SKIP, total_pages: SKIP, links: SKIP) ⇒ PlanCollection
Returns a new instance of PlanCollection.
54 55 56 57 58 59 60 |
# File 'lib/paypal_server_sdk/models/plan_collection.rb', line 54 def initialize(plans: SKIP, total_items: SKIP, total_pages: SKIP, links: SKIP) @plans = plans unless plans == SKIP @total_items = total_items unless total_items == SKIP @total_pages = total_pages unless total_pages == SKIP @links = links unless links == SKIP end |
Instance Attribute Details
#links ⇒ Array[LinkDescription]
An array of request-related [HATEOAS links](/docs/api/reference/api-responses/#hateoas-links).
27 28 29 |
# File 'lib/paypal_server_sdk/models/plan_collection.rb', line 27 def links @links end |
#plans ⇒ Array[BillingPlan]
An array of plans.
14 15 16 |
# File 'lib/paypal_server_sdk/models/plan_collection.rb', line 14 def plans @plans end |
#total_items ⇒ Integer
The total number of items.
18 19 20 |
# File 'lib/paypal_server_sdk/models/plan_collection.rb', line 18 def total_items @total_items end |
#total_pages ⇒ Integer
The total number of pages.
22 23 24 |
# File 'lib/paypal_server_sdk/models/plan_collection.rb', line 22 def total_pages @total_pages end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
63 64 65 66 67 68 69 70 71 72 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/paypal_server_sdk/models/plan_collection.rb', line 63 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. # Parameter is an array, so we need to iterate through it plans = nil unless hash['plans'].nil? plans = [] hash['plans'].each do |structure| plans << (BillingPlan.from_hash(structure) if structure) end end plans = SKIP unless hash.key?('plans') total_items = hash.key?('total_items') ? hash['total_items'] : SKIP total_pages = hash.key?('total_pages') ? hash['total_pages'] : SKIP # Parameter is an array, so we need to iterate through it links = nil unless hash['links'].nil? links = [] hash['links'].each do |structure| links << (LinkDescription.from_hash(structure) if structure) end end links = SKIP unless hash.key?('links') # Create object from extracted values. PlanCollection.new(plans: plans, total_items: total_items, total_pages: total_pages, links: links) end |
.names ⇒ Object
A mapping from model property names to API property names.
30 31 32 33 34 35 36 37 |
# File 'lib/paypal_server_sdk/models/plan_collection.rb', line 30 def self.names @_hash = {} if @_hash.nil? @_hash['plans'] = 'plans' @_hash['total_items'] = 'total_items' @_hash['total_pages'] = 'total_pages' @_hash['links'] = 'links' @_hash end |
.nullables ⇒ Object
An array for nullable fields
50 51 52 |
# File 'lib/paypal_server_sdk/models/plan_collection.rb', line 50 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
40 41 42 43 44 45 46 47 |
# File 'lib/paypal_server_sdk/models/plan_collection.rb', line 40 def self.optionals %w[ plans total_items total_pages links ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
105 106 107 108 109 |
# File 'lib/paypal_server_sdk/models/plan_collection.rb', line 105 def inspect class_name = self.class.name.split('::').last "<#{class_name} plans: #{@plans.inspect}, total_items: #{@total_items.inspect},"\ " total_pages: #{@total_pages.inspect}, links: #{@links.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
98 99 100 101 102 |
# File 'lib/paypal_server_sdk/models/plan_collection.rb', line 98 def to_s class_name = self.class.name.split('::').last "<#{class_name} plans: #{@plans}, total_items: #{@total_items}, total_pages:"\ " #{@total_pages}, links: #{@links}>" end |