Class: UspsApi::InternationalLabelsReprintInfo
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- UspsApi::InternationalLabelsReprintInfo
- Defined in:
- lib/usps_api/models/international_labels_reprint_info.rb
Overview
Schema containing reprint information for a label.
Instance Attribute Summary collapse
-
#reprint_limit ⇒ Integer
Maximum number of reprints permitted for the label.
-
#reprint_number ⇒ Integer
Count of reprints made for the label.
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.
-
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
Instance Method Summary collapse
-
#initialize(reprint_number: SKIP, reprint_limit: SKIP) ⇒ InternationalLabelsReprintInfo
constructor
A new instance of InternationalLabelsReprintInfo.
-
#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(reprint_number: SKIP, reprint_limit: SKIP) ⇒ InternationalLabelsReprintInfo
Returns a new instance of InternationalLabelsReprintInfo.
41 42 43 44 |
# File 'lib/usps_api/models/international_labels_reprint_info.rb', line 41 def initialize(reprint_number: SKIP, reprint_limit: SKIP) @reprint_number = reprint_number unless reprint_number == SKIP @reprint_limit = reprint_limit unless reprint_limit == SKIP end |
Instance Attribute Details
#reprint_limit ⇒ Integer
Maximum number of reprints permitted for the label.
18 19 20 |
# File 'lib/usps_api/models/international_labels_reprint_info.rb', line 18 def reprint_limit @reprint_limit end |
#reprint_number ⇒ Integer
Count of reprints made for the label.
14 15 16 |
# File 'lib/usps_api/models/international_labels_reprint_info.rb', line 14 def reprint_number @reprint_number end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
47 48 49 50 51 52 53 54 55 56 57 |
# File 'lib/usps_api/models/international_labels_reprint_info.rb', line 47 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. reprint_number = hash.key?('reprintNumber') ? hash['reprintNumber'] : SKIP reprint_limit = hash.key?('reprintLimit') ? hash['reprintLimit'] : SKIP # Create object from extracted values. InternationalLabelsReprintInfo.new(reprint_number: reprint_number, reprint_limit: reprint_limit) end |
.names ⇒ Object
A mapping from model property names to API property names.
21 22 23 24 25 26 |
# File 'lib/usps_api/models/international_labels_reprint_info.rb', line 21 def self.names @_hash = {} if @_hash.nil? @_hash['reprint_number'] = 'reprintNumber' @_hash['reprint_limit'] = 'reprintLimit' @_hash end |
.nullables ⇒ Object
An array for nullable fields
37 38 39 |
# File 'lib/usps_api/models/international_labels_reprint_info.rb', line 37 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
29 30 31 32 33 34 |
# File 'lib/usps_api/models/international_labels_reprint_info.rb', line 29 def self.optionals %w[ reprint_number reprint_limit ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
61 62 63 64 65 66 67 |
# File 'lib/usps_api/models/international_labels_reprint_info.rb', line 61 def self.validate(value) return true if value.instance_of? self return false unless value.instance_of? Hash true end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
76 77 78 79 80 |
# File 'lib/usps_api/models/international_labels_reprint_info.rb', line 76 def inspect class_name = self.class.name.split('::').last "<#{class_name} reprint_number: #{@reprint_number.inspect}, reprint_limit:"\ " #{@reprint_limit.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
70 71 72 73 |
# File 'lib/usps_api/models/international_labels_reprint_info.rb', line 70 def to_s class_name = self.class.name.split('::').last "<#{class_name} reprint_number: #{@reprint_number}, reprint_limit: #{@reprint_limit}>" end |