Class: NewStoreApi::UpdatePackageTypeRequest

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/new_store_api/models/update_package_type_request.rb

Overview

Request body for updating an existing package type. All fields are optional; only provided fields will be updated.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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 = SKIP, name = SKIP, weight = SKIP) ⇒ UpdatePackageTypeRequest

Returns a new instance of UpdatePackageTypeRequest.



52
53
54
55
56
# File 'lib/new_store_api/models/update_package_type_request.rb', line 52

def initialize(dimensions = SKIP, name = SKIP, weight = SKIP)
  @dimensions = dimensions unless dimensions == SKIP
  @name = name unless name == SKIP
  @weight = weight unless weight == SKIP
end

Instance Attribute Details

#dimensionsPackageDimensions

TODO: Write general description for this method

Returns:



15
16
17
# File 'lib/new_store_api/models/update_package_type_request.rb', line 15

def dimensions
  @dimensions
end

#nameString

Display name shown to associates when selecting a package.

Returns:

  • (String)


19
20
21
# File 'lib/new_store_api/models/update_package_type_request.rb', line 19

def name
  @name
end

#weightPackageWeight

Display name shown to associates when selecting a package.

Returns:



23
24
25
# File 'lib/new_store_api/models/update_package_type_request.rb', line 23

def weight
  @weight
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/new_store_api/models/update_package_type_request.rb', line 59

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'] : SKIP
  weight = PackageWeight.from_hash(hash['weight']) if hash['weight']

  # Create object from extracted values.
  UpdatePackageTypeRequest.new(dimensions,
                               name,
                               weight)
end

.namesObject

A mapping from model property names to API property names.



26
27
28
29
30
31
32
# File 'lib/new_store_api/models/update_package_type_request.rb', line 26

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['dimensions'] = 'dimensions'
  @_hash['name'] = 'name'
  @_hash['weight'] = 'weight'
  @_hash
end

.nullablesObject

An array for nullable fields



44
45
46
47
48
49
50
# File 'lib/new_store_api/models/update_package_type_request.rb', line 44

def self.nullables
  %w[
    dimensions
    name
    weight
  ]
end

.optionalsObject

An array for optional fields



35
36
37
38
39
40
41
# File 'lib/new_store_api/models/update_package_type_request.rb', line 35

def self.optionals
  %w[
    dimensions
    name
    weight
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



80
81
82
83
84
# File 'lib/new_store_api/models/update_package_type_request.rb', line 80

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} dimensions: #{@dimensions.inspect}, name: #{@name.inspect}, weight:"\
  " #{@weight.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



74
75
76
77
# File 'lib/new_store_api/models/update_package_type_request.rb', line 74

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} dimensions: #{@dimensions}, name: #{@name}, weight: #{@weight}>"
end