Method: AmznSpApi::ServicesApiModel::FixedSlot#initialize

Defined in:
lib/services_api_model/models/fixed_slot.rb

#initialize(attributes = {}) ⇒ FixedSlot

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash

Raises:

  • (ArgumentError)


59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/services_api_model/models/fixed_slot.rb', line 59

def initialize(attributes = {})
  raise ArgumentError, 'The input argument (attributes) must be a hash in `AmznSpApi::ServicesApiModel::FixedSlot` initialize method' unless attributes.is_a?(Hash)

  # check to see if the attribute exists and convert string to symbol for hash key
  attributes = attributes.each_with_object({}) do |(k, v), h|
    raise ArgumentError, "`#{k}` is not a valid attribute in `AmznSpApi::ServicesApiModel::FixedSlot`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect unless self.class.attribute_map.key?(k.to_sym)

    h[k.to_sym] = v
  end

  self.start_date_time = attributes[:start_date_time] if attributes.key?(:start_date_time)

  self.scheduled_capacity = attributes[:scheduled_capacity] if attributes.key?(:scheduled_capacity)

  self.available_capacity = attributes[:available_capacity] if attributes.key?(:available_capacity)

  self.encumbered_capacity = attributes[:encumbered_capacity] if attributes.key?(:encumbered_capacity)

  return unless attributes.key?(:reserved_capacity)

  self.reserved_capacity = attributes[:reserved_capacity]
end