Class: ErpIntegration::Fulfil::Resources::StockBinTransfer
- Inherits:
-
ApiResource
- Object
- ApiResource
- ErpIntegration::Fulfil::Resources::StockBinTransfer
- Defined in:
- lib/erp_integration/fulfil/resources/stock_bin_transfer.rb
Constant Summary
Constants included from PaginationMethods
PaginationMethods::DEFAULT_LIMIT, PaginationMethods::DEFAULT_OFFSET, PaginationMethods::MAX_LIMIT
Instance Attribute Summary
Attributes inherited from ApiResource
Attributes included from QueryMethods
#or_clauses, #selected_fields, #where_clauses
Attributes included from PaginationMethods
#limit_value, #offset_value, #page_number
Instance Method Summary collapse
-
#assign_force(id) ⇒ boolean
Allows bulk force assign bin transfers over the API to move assigned inventory to the new bin location.
-
#done(id) ⇒ boolean
Allows bulk mark the bin transfers as done over the API to finish moving the inventory to the new bin location.
Methods inherited from ApiResource
#all, api_keys_pool, api_keys_pool=, client, config, #count, #each, #find_each, #initialize, model_name, model_name=
Methods included from QueryMethods
#or, #or!, #select, #select!, #where, #where!, #where_domain, #where_ilike, #where_in, #where_less_or_equal_to, #where_less_than, #where_like, #where_more_or_equal_to, #where_more_than, #where_not, #where_not_in
Methods included from Persistence
Methods included from PaginationMethods
#limit, #limit!, #offset, #offset!, #page, #page!
Methods included from FinderMethods
Methods included from Context
Constructor Details
This class inherits a constructor from ErpIntegration::Fulfil::ApiResource
Instance Method Details
#assign_force(id) ⇒ boolean
Allows bulk force assign bin transfers over the API to move assigned inventory to the new bin location.
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/erp_integration/fulfil/resources/stock_bin_transfer.rb', line 15 def assign_force(id) client.put("model/stock.bin_transfer/#{id}/assign_force") true # Fulfil will return an 400 (a.k.a. "Bad Request") status code when a bin trasfer couldn't # be done. If a bit trasfer isn't assignable by design, no exception should be raised. # # See the Fulfil's documentation for more information: # https://developers.fulfil.io/rest_api/model/stock.bin_transfer/#force-allocate-inventory-to-the-transfer rescue ErpIntegration::HttpError::BadRequest false # Workaround: Fulfil api does not return a json when status code is 200 (a.k.a. "Ok") # and faraday is having an error when trying to parse it. Let's skip the parse error # and move on. rescue Faraday::ParsingError true end |
#done(id) ⇒ boolean
Allows bulk mark the bin transfers as done over the API to finish moving the inventory to the new bin location. It is better practice for inventory accuracy to mark the bin transfer as done once the inventory is physically moved to the new location.
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/erp_integration/fulfil/resources/stock_bin_transfer.rb', line 39 def done(id) client.put("model/stock.bin_transfer/#{id}/done") true # Fulfil will return an 400 (a.k.a. "Bad Request") status code when a bin trasfer couldn't # be done. If a bit trasfer isn't doneable by design, no exception should be raised. # # See the Fulfil's documentation for more information: # https://developers.fulfil.io/rest_api/model/stock.bin_transfer/#mark-transfer-as-done rescue ErpIntegration::HttpError::BadRequest false # Workaround: Fulfil api does not return a json when status code is 200 (a.k.a. "Ok") # and faraday is having an error when trying to parse it. Let's skip the parse error # and move on. rescue Faraday::ParsingError true end |