Class: NewStoreApi::CreatePackageTypeRequest
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- NewStoreApi::CreatePackageTypeRequest
- Defined in:
- lib/new_store_api/models/create_package_type_request.rb
Overview
Request body for creating a new package type. Package types define the packages available for an associate to choose from during the packing flow in the Associate App.
Instance Attribute Summary collapse
-
#dimensions ⇒ PackageDimensions
The physical dimensions of a package type.
-
#name ⇒ String
Display name shown to associates when selecting a package.
-
#weight ⇒ PackageWeight
The weight of a package type.
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(dimensions = nil, name = nil, weight = nil) ⇒ CreatePackageTypeRequest
constructor
A new instance of CreatePackageTypeRequest.
-
#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(dimensions = nil, name = nil, weight = nil) ⇒ CreatePackageTypeRequest
Returns a new instance of CreatePackageTypeRequest.
45 46 47 48 49 |
# File 'lib/new_store_api/models/create_package_type_request.rb', line 45 def initialize(dimensions = nil, name = nil, weight = nil) @dimensions = dimensions @name = name @weight = weight end |
Instance Attribute Details
#dimensions ⇒ PackageDimensions
The physical dimensions of a package type.
16 17 18 |
# File 'lib/new_store_api/models/create_package_type_request.rb', line 16 def dimensions @dimensions end |
#name ⇒ String
Display name shown to associates when selecting a package.
20 21 22 |
# File 'lib/new_store_api/models/create_package_type_request.rb', line 20 def name @name end |
#weight ⇒ PackageWeight
The weight of a package type.
24 25 26 |
# File 'lib/new_store_api/models/create_package_type_request.rb', line 24 def weight @weight end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
52 53 54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/new_store_api/models/create_package_type_request.rb', line 52 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. dimensions = PackageDimensions.from_hash(hash['dimensions']) if hash['dimensions'] name = hash.key?('name') ? hash['name'] : nil weight = PackageWeight.from_hash(hash['weight']) if hash['weight'] # Create object from extracted values. CreatePackageTypeRequest.new(dimensions, name, weight) end |
.names ⇒ Object
A mapping from model property names to API property names.
27 28 29 30 31 32 33 |
# File 'lib/new_store_api/models/create_package_type_request.rb', line 27 def self.names @_hash = {} if @_hash.nil? @_hash['dimensions'] = 'dimensions' @_hash['name'] = 'name' @_hash['weight'] = 'weight' @_hash end |
.nullables ⇒ Object
An array for nullable fields
41 42 43 |
# File 'lib/new_store_api/models/create_package_type_request.rb', line 41 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
36 37 38 |
# File 'lib/new_store_api/models/create_package_type_request.rb', line 36 def self.optionals [] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
73 74 75 76 77 |
# File 'lib/new_store_api/models/create_package_type_request.rb', line 73 def inspect class_name = self.class.name.split('::').last "<#{class_name} dimensions: #{@dimensions.inspect}, name: #{@name.inspect}, weight:"\ " #{@weight.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
67 68 69 70 |
# File 'lib/new_store_api/models/create_package_type_request.rb', line 67 def to_s class_name = self.class.name.split('::').last "<#{class_name} dimensions: #{@dimensions}, name: #{@name}, weight: #{@weight}>" end |