Sha256: 2d864ff14003c45bd5d3fe22ba34feb4753af31aa07e942602a515f3c3f76189

Contents?: true

Size: 789 Bytes

Versions: 5

Compression:

Stored size: 789 Bytes

Contents

# frozen_string_literal: true

module MyTankInfo
  class TankDeliveriesResource < Resource
    def list(tank_id:, **params)
      response = get_request("api/tanks/#{tank_id}/deliveries", params: params)
      Collection.from_response(response, type: TankDeliveryRecord)
    end

    def update(tank_id:, delivery_id:, **attributes)
      required_attributes = [
        :start_date_and_time,
        :start_gross,
        :stop_date_and_time,
        :stop_gross,
        :delivery_net,
        :delivery_gross,
        :bol_number
      ]

      enforce_required_attributes(required_attrs: required_attributes, attrs: attributes)

      request = put_request("api/tanks/#{tank_id}/deliveries/#{delivery_id}", body: attributes)
      TankDeliveryRecord.new request.body
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
my_tank_info-1.1.1 lib/my_tank_info/resources/tank_deliveries.rb
my_tank_info-1.1.0 lib/my_tank_info/resources/tank_deliveries.rb
my_tank_info-1.0.2 lib/my_tank_info/resources/tank_deliveries.rb
my_tank_info-1.0.1 lib/my_tank_info/resources/tank_deliveries.rb
my_tank_info-1.0.0 lib/my_tank_info/resources/tank_deliveries.rb