Class: UspsApi::LiftTypes

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/usps_api/models/lift_types.rb

Overview

Types of lifts available at the facility.

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(manual_lift: SKIP, electric_gas_lift: SKIP, cage_stacker_lift: SKIP, roller_table_extender_lift: SKIP, additional_properties: nil) ⇒ LiftTypes

Returns a new instance of LiftTypes.



54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/usps_api/models/lift_types.rb', line 54

def initialize(manual_lift: SKIP, electric_gas_lift: SKIP,
               cage_stacker_lift: SKIP, roller_table_extender_lift: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @manual_lift = manual_lift unless manual_lift == SKIP
  @electric_gas_lift = electric_gas_lift unless electric_gas_lift == SKIP
  @cage_stacker_lift = cage_stacker_lift unless cage_stacker_lift == SKIP
  unless roller_table_extender_lift == SKIP
    @roller_table_extender_lift =
      roller_table_extender_lift
  end
  @additional_properties = additional_properties
end

Instance Attribute Details

#cage_stacker_liftTrueClass | FalseClass

Indicates whether a cage stacker lift is available at the facility.

Returns:

  • (TrueClass | FalseClass)


22
23
24
# File 'lib/usps_api/models/lift_types.rb', line 22

def cage_stacker_lift
  @cage_stacker_lift
end

#electric_gas_liftTrueClass | FalseClass

Indicates whether a electric or gas lift is available at the facility.

Returns:

  • (TrueClass | FalseClass)


18
19
20
# File 'lib/usps_api/models/lift_types.rb', line 18

def electric_gas_lift
  @electric_gas_lift
end

#manual_liftTrueClass | FalseClass

Indicates whether a manual lift is available at the facility.

Returns:

  • (TrueClass | FalseClass)


14
15
16
# File 'lib/usps_api/models/lift_types.rb', line 14

def manual_lift
  @manual_lift
end

#roller_table_extender_liftTrueClass | FalseClass

Indicates whether a roller table or extender lift is available at the facility.

Returns:

  • (TrueClass | FalseClass)


27
28
29
# File 'lib/usps_api/models/lift_types.rb', line 27

def roller_table_extender_lift
  @roller_table_extender_lift
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
96
# File 'lib/usps_api/models/lift_types.rb', line 71

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  manual_lift = hash.key?('manualLift') ? hash['manualLift'] : SKIP
  electric_gas_lift =
    hash.key?('electricGasLift') ? hash['electricGasLift'] : SKIP
  cage_stacker_lift =
    hash.key?('cageStackerLift') ? hash['cageStackerLift'] : SKIP
  roller_table_extender_lift =
    hash.key?('rollerTableExtenderLift') ? hash['rollerTableExtenderLift'] : SKIP

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  LiftTypes.new(manual_lift: manual_lift,
                electric_gas_lift: electric_gas_lift,
                cage_stacker_lift: cage_stacker_lift,
                roller_table_extender_lift: roller_table_extender_lift,
                additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



30
31
32
33
34
35
36
37
# File 'lib/usps_api/models/lift_types.rb', line 30

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['manual_lift'] = 'manualLift'
  @_hash['electric_gas_lift'] = 'electricGasLift'
  @_hash['cage_stacker_lift'] = 'cageStackerLift'
  @_hash['roller_table_extender_lift'] = 'rollerTableExtenderLift'
  @_hash
end

.nullablesObject

An array for nullable fields



50
51
52
# File 'lib/usps_api/models/lift_types.rb', line 50

def self.nullables
  []
end

.optionalsObject

An array for optional fields



40
41
42
43
44
45
46
47
# File 'lib/usps_api/models/lift_types.rb', line 40

def self.optionals
  %w[
    manual_lift
    electric_gas_lift
    cage_stacker_lift
    roller_table_extender_lift
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



107
108
109
110
111
112
113
# File 'lib/usps_api/models/lift_types.rb', line 107

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} manual_lift: #{@manual_lift.inspect}, electric_gas_lift:"\
  " #{@electric_gas_lift.inspect}, cage_stacker_lift: #{@cage_stacker_lift.inspect},"\
  " roller_table_extender_lift: #{@roller_table_extender_lift.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



99
100
101
102
103
104
# File 'lib/usps_api/models/lift_types.rb', line 99

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} manual_lift: #{@manual_lift}, electric_gas_lift: #{@electric_gas_lift},"\
  " cage_stacker_lift: #{@cage_stacker_lift}, roller_table_extender_lift:"\
  " #{@roller_table_extender_lift}, additional_properties: #{@additional_properties}>"
end