Class: MontaAPI::ReturnResource

Inherits:
Resource
  • Object
show all
Defined in:
lib/monta_api/resources/return_resource.rb

Instance Attribute Summary

Attributes inherited from Resource

#client

Instance Method Summary collapse

Methods inherited from Resource

#get_request, #handle_response, #initialize, #post_request, #put_request

Constructor Details

This class inherits a constructor from MontaAPI::Resource

Instance Method Details

#updateObject



43
44
45
# File 'lib/monta_api/resources/return_resource.rb', line 43

def update
  # Update the follow up actions per Return Line
end

#where(since:, status: "any") ⇒ Object

@client.return.where(since: “2024-04-05”, status: “any”) Response: { “Returns”: [ { “Id”: 3873210, “CreatedAt”: “2024-04-05T08:40:40.327”, “Comment”: null, “Cause”: “Ik ben van gedachten veranderd”, “WebshopCause”: null, “WebshopOrderId”: “1173”, “Lines”: [ { “WebshopOrderLineId”: “14638817116463”, “Sku”: “ABC”, “ReturnedQuantity”: 1, “Sellable”: true, “FollowedUpMontapacking”: false, “FollowedUpCustomer”: false, “FollowedUpAction”: null, “Cause”: “Ik ben van gedachten veranderd”, “Comment”: null, “BatchCode”: null } ], “UpdatedAt”: “2024-04-05T08:41:33.81”, “SerialNumbers”: [], “ReturnForecastId”: 2361500, “ForecastCode”: “2” } ] }



37
38
39
40
41
# File 'lib/monta_api/resources/return_resource.rb', line 37

def where(since:, status: "any")
  response_body = get_request("return/updated_since/#{since}", params: { status: status }).body

  response_body["Returns"].map { |attributes| Return.new(attributes) }
end