Class: FlexCommerce::Address
- Inherits:
-
FlexCommerceApi::ApiBase
- Object
- JsonApiClient::Resource
- FlexCommerceApi::BaseResource
- FlexCommerceApi::ApiBase
- FlexCommerce::Address
- Defined in:
- app/models/address.rb
Overview
A flex commerce Address model
This model provides access to the flex commerce addresses
It is used much like an active record model.
Examples:
# Fetching all addresses for a customer account
customer_account.addresses.all #fetches all addresses(actually the first page in case there are thousands)
Constant Summary
Constants inherited from FlexCommerceApi::BaseResource
FlexCommerceApi::BaseResource::PRIVATE_ATTRIBUTES, FlexCommerceApi::BaseResource::RELATED_META_RESOURCES
Class Method Summary collapse
Methods inherited from FlexCommerceApi::ApiBase
Methods inherited from FlexCommerceApi::BaseResource
all, append_version, #as_json_api, capture_surrogate_keys, create!, endpoint_version, find, find_all, #freeze, #initialize, load, #meta_attribute, #method_missing, paginate, password, #public_attributes, reconfigure, reconfigure_all, reconfigure_api_base, reload_connection_if_required, #save!, username
Constructor Details
This class inherits a constructor from FlexCommerceApi::BaseResource
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class FlexCommerceApi::BaseResource
Class Method Details
.path(params, instance = nil) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 |
# File 'app/models/address.rb', line 25 def path(params, instance = nil) if params[:filter] && params[:filter].key?(:customer_account_id) customer_account_id = params[:filter].delete(:customer_account_id) params.delete(:filter) if params[:filter].empty? "customer_accounts/#{customer_account_id}/addresses" elsif instance && instance.try(:customer_account_id).try(:present?) "customer_accounts/#{instance.customer_account_id}/addresses" else super end end |