Class: UspsApi::SubscriptionsDisputesPaginationMetadata
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- UspsApi::SubscriptionsDisputesPaginationMetadata
- Defined in:
- lib/usps_api/models/subscriptions_disputes_pagination_metadata.rb
Overview
Standard error message response.
Instance Attribute Summary collapse
-
#limit ⇒ Integer
The number of resources returned per call, based on the user provided limit.
-
#links ⇒ Array[AdjustmentsHypermediaLink]
Hypermedia links to related resources.
-
#offset ⇒ Integer
The current offset, based on the user provided offset.
-
#page ⇒ Integer
The current page number.
-
#total_count ⇒ Integer
Total number of resources return in the API request.
-
#total_pages ⇒ Integer
Total number of pages, based on the user provided limit and [totalCount].
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(limit:, offset:, total_count: SKIP, page: SKIP, total_pages: SKIP, links: SKIP) ⇒ SubscriptionsDisputesPaginationMetadata
constructor
A new instance of SubscriptionsDisputesPaginationMetadata.
-
#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(limit:, offset:, total_count: SKIP, page: SKIP, total_pages: SKIP, links: SKIP) ⇒ SubscriptionsDisputesPaginationMetadata
Returns a new instance of SubscriptionsDisputesPaginationMetadata.
64 65 66 67 68 69 70 71 72 |
# File 'lib/usps_api/models/subscriptions_disputes_pagination_metadata.rb', line 64 def initialize(limit:, offset:, total_count: SKIP, page: SKIP, total_pages: SKIP, links: SKIP) @total_count = total_count unless total_count == SKIP @page = page unless page == SKIP @total_pages = total_pages unless total_pages == SKIP @limit = limit @offset = offset @links = links unless links == SKIP end |
Instance Attribute Details
#limit ⇒ Integer
The number of resources returned per call, based on the user provided limit
27 28 29 |
# File 'lib/usps_api/models/subscriptions_disputes_pagination_metadata.rb', line 27 def limit @limit end |
#links ⇒ Array[AdjustmentsHypermediaLink]
Hypermedia links to related resources.
35 36 37 |
# File 'lib/usps_api/models/subscriptions_disputes_pagination_metadata.rb', line 35 def links @links end |
#offset ⇒ Integer
The current offset, based on the user provided offset
31 32 33 |
# File 'lib/usps_api/models/subscriptions_disputes_pagination_metadata.rb', line 31 def offset @offset end |
#page ⇒ Integer
The current page number.
18 19 20 |
# File 'lib/usps_api/models/subscriptions_disputes_pagination_metadata.rb', line 18 def page @page end |
#total_count ⇒ Integer
Total number of resources return in the API request.
14 15 16 |
# File 'lib/usps_api/models/subscriptions_disputes_pagination_metadata.rb', line 14 def total_count @total_count end |
#total_pages ⇒ Integer
Total number of pages, based on the user provided limit and [totalCount]
22 23 24 |
# File 'lib/usps_api/models/subscriptions_disputes_pagination_metadata.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.
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
# File 'lib/usps_api/models/subscriptions_disputes_pagination_metadata.rb', line 75 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. limit = hash.key?('limit') ? hash['limit'] : nil offset = hash.key?('offset') ? hash['offset'] : nil total_count = hash.key?('totalCount') ? hash['totalCount'] : SKIP page = hash.key?('page') ? hash['page'] : SKIP total_pages = hash.key?('totalPages') ? hash['totalPages'] : 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 << (AdjustmentsHypermediaLink.from_hash(structure) if structure) end end links = SKIP unless hash.key?('links') # Create object from extracted values. SubscriptionsDisputesPaginationMetadata.new(limit: limit, offset: offset, total_count: total_count, page: page, total_pages: total_pages, links: links) end |
.names ⇒ Object
A mapping from model property names to API property names.
38 39 40 41 42 43 44 45 46 47 |
# File 'lib/usps_api/models/subscriptions_disputes_pagination_metadata.rb', line 38 def self.names @_hash = {} if @_hash.nil? @_hash['total_count'] = 'totalCount' @_hash['page'] = 'page' @_hash['total_pages'] = 'totalPages' @_hash['limit'] = 'limit' @_hash['offset'] = 'offset' @_hash['links'] = 'links' @_hash end |
.nullables ⇒ Object
An array for nullable fields
60 61 62 |
# File 'lib/usps_api/models/subscriptions_disputes_pagination_metadata.rb', line 60 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
50 51 52 53 54 55 56 57 |
# File 'lib/usps_api/models/subscriptions_disputes_pagination_metadata.rb', line 50 def self.optionals %w[ total_count page total_pages links ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
112 113 114 115 116 117 |
# File 'lib/usps_api/models/subscriptions_disputes_pagination_metadata.rb', line 112 def inspect class_name = self.class.name.split('::').last "<#{class_name} total_count: #{@total_count.inspect}, page: #{@page.inspect}, total_pages:"\ " #{@total_pages.inspect}, limit: #{@limit.inspect}, offset: #{@offset.inspect}, links:"\ " #{@links.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
105 106 107 108 109 |
# File 'lib/usps_api/models/subscriptions_disputes_pagination_metadata.rb', line 105 def to_s class_name = self.class.name.split('::').last "<#{class_name} total_count: #{@total_count}, page: #{@page}, total_pages: #{@total_pages},"\ " limit: #{@limit}, offset: #{@offset}, links: #{@links}>" end |