Module: SpreePlatformApiClient::Actions
- Included in:
- Client
- Defined in:
- lib/spree_platform_api_client/actions.rb
Instance Method Summary collapse
- #create(endpoint_name, params = {}) ⇒ Object
- #delete(endpoint_name, resource_id) ⇒ Object
- #index(endpoint_name, params = {}) ⇒ Object
- #show(endpoint_name, resource_id, params = {}) ⇒ Object
- #update(endpoint_name, resource_id, params = {}) ⇒ Object
Instance Method Details
#create(endpoint_name, params = {}) ⇒ Object
19 20 21 |
# File 'lib/spree_platform_api_client/actions.rb', line 19 def create(endpoint_name, params = {}) action(authenticated_client.post(build_collection_uri(get_path(endpoint_name)), json: params)) end |
#delete(endpoint_name, resource_id) ⇒ Object
27 28 29 |
# File 'lib/spree_platform_api_client/actions.rb', line 27 def delete(endpoint_name, resource_id) action(authenticated_client.delete(build_resource_uri(get_path(endpoint_name), resource_id))) end |
#index(endpoint_name, params = {}) ⇒ Object
3 4 5 6 7 8 9 |
# File 'lib/spree_platform_api_client/actions.rb', line 3 def index(endpoint_name, params = {}) action( authenticated_client .use(:auto_deflate) .get(build_collection_uri(get_path(endpoint_name)), params: params) ) end |
#show(endpoint_name, resource_id, params = {}) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/spree_platform_api_client/actions.rb', line 11 def show(endpoint_name, resource_id, params = {}) action( authenticated_client .use(:auto_deflate) .get(build_resource_uri(get_path(endpoint_name), resource_id), params: params) ) end |
#update(endpoint_name, resource_id, params = {}) ⇒ Object
23 24 25 |
# File 'lib/spree_platform_api_client/actions.rb', line 23 def update(endpoint_name, resource_id, params = {}) action(authenticated_client.patch(build_resource_uri(get_path(endpoint_name), resource_id), json: params)) end |