Class: MyTankInfo::TankDeliveriesResource
- Defined in:
- lib/my_tank_info/resources/tank_deliveries.rb
Instance Attribute Summary
Attributes inherited from Resource
Instance Method Summary collapse
Methods inherited from Resource
#delete_request, #get_request, #initialize, #patch_request, #post_request, #put_request
Constructor Details
This class inherits a constructor from MyTankInfo::Resource
Instance Method Details
#list(tank_id:, **params) ⇒ Object
5 6 7 8 |
# File 'lib/my_tank_info/resources/tank_deliveries.rb', line 5 def list(tank_id:, **params) response = get_request("api/tanks/#{tank_id}/deliveries", params: params) Collection.from_response(response, type: TankDeliveryRecord) end |
#update(tank_id:, delivery_id:, **attributes) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/my_tank_info/resources/tank_deliveries.rb', line 10 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 |