Module: Locations
- Included in:
- Ecommerce
- Defined in:
- lib/user/ecommerce/locations.rb
Instance Method Summary collapse
-
#create_location(data, options = nil) ⇒ Object
Create location.
-
#create_location_template(data) ⇒ Object
Create location template.
-
#delete_location(id) ⇒ Object
Delete location.
-
#get_location(id, options = nil) ⇒ Object
Get location.
-
#get_location_template(id, options = nil) ⇒ Object
Get location template.
-
#get_location_template_support_data(id) ⇒ Object
Get location template support data.
-
#get_location_templates(options = nil) ⇒ Object
Get location templates.
-
#get_location_templates_support_data ⇒ Object
Get location templates support data.
-
#get_locations(options = nil, use_post = true) ⇒ Object
Get locations.
-
#update_location(id, data, options = nil) ⇒ Object
Update location.
-
#update_location_template(id, data) ⇒ Object
Update location template.
Instance Method Details
#create_location(data, options = nil) ⇒ Object
Create location.
Create a location with data.
Parameters
- data
-
(Hash) – Data to be submitted.
Example
data = {
title: 'New Location',
location_template_id: 1
}
@data = @cxf_user.create_location(data)
50 51 52 |
# File 'lib/user/ecommerce/locations.rb', line 50 def create_location(data, = nil) @client.raw('post', '/ecommerce/locations', , data_transform(data)) end |
#create_location_template(data) ⇒ Object
Create location template.
Create a location template with data.
Parameters
- data
-
(Hash) – Data to be submitted.
Example
data = {
title: 'New Location Template',
slug: 'new-location-template'
}
@data = @cxf_user.create_location_template(data)
152 153 154 |
# File 'lib/user/ecommerce/locations.rb', line 152 def create_location_template(data) @client.raw('post', '/ecommerce/location-templates', nil, data_transform(data)) end |
#delete_location(id) ⇒ Object
Delete location.
Delete a location.
Parameters
- id
-
(Integer) – Location id.
Example
@data = @cxf_user.delete_location(5)
78 79 80 |
# File 'lib/user/ecommerce/locations.rb', line 78 def delete_location(id) @client.raw('delete', "/ecommerce/locations/#{id}") end |
#get_location(id, options = nil) ⇒ Object
Get location.
Get a location info.
Parameters
- id
-
(Integer) – Location id.
Example
@data = @cxf_user.get_location(2)
34 35 36 |
# File 'lib/user/ecommerce/locations.rb', line 34 def get_location(id, = nil) @client.raw('get', "/ecommerce/locations/#{id}", ) end |
#get_location_template(id, options = nil) ⇒ Object
Get location template.
Get a location template info.
Parameters
- id
-
(Integer) – Location template id.
- options
-
(Hash) – List of Resource Collection Options shown above can be used as parameter.
First Example
@data = @cxf_user.get_location_template(1)
Second Example
= { fields: 'title' }
@data = @cxf_user.get_location_template(1, )
136 137 138 |
# File 'lib/user/ecommerce/locations.rb', line 136 def get_location_template(id, = nil) @client.raw('get', "/ecommerce/location-templates/#{id}", ) end |
#get_location_template_support_data(id) ⇒ Object
Get location template support data.
Get support data used in a location template.
Parameters
- id
-
(Integer) – Location template id.
Example
@data = @cxf_user.get_location_template_support_data(1)
94 95 96 |
# File 'lib/user/ecommerce/locations.rb', line 94 def get_location_template_support_data(id) @client.raw('get', "/ecommerce/location-templates/#{id}/support-data") end |
#get_location_templates(options = nil) ⇒ Object
Get location templates.
Get a collection of location templates.
Parameters
- options
-
(Hash) – List of Resource Collection Options shown above can be used as parameter.
First Example
@data = @cxf_user.get_location_templates
Second Example
= { fields: 'title' }
@data = @cxf_user.get_location_templates()
119 120 121 |
# File 'lib/user/ecommerce/locations.rb', line 119 def get_location_templates( = nil) @client.raw('get', '/ecommerce/location-templates', ) end |
#get_location_templates_support_data ⇒ Object
Get location templates support data.
Get support data used in location templates.
Example
@data = @cxf_user.get_location_templates_support_data
103 104 105 |
# File 'lib/user/ecommerce/locations.rb', line 103 def get_location_templates_support_data @client.raw('get', '/ecommerce/location-templates/support-data') end |
#get_locations(options = nil, use_post = true) ⇒ Object
Get locations.
Get a collection of locations.
Parameters
- use_post
-
(Boolean) – Variable to determine if the request is by ‘post’ or ‘get’ functions.
First Example
@data = @cxf_user.get_locations
Second Example
= {
fields: 'id, title'
}
@data = @cxf_user.get_locations()
22 23 24 |
# File 'lib/user/ecommerce/locations.rb', line 22 def get_locations( = nil, use_post = true) get_query_results('/ecommerce/locations', , use_post) end |
#update_location(id, data, options = nil) ⇒ Object
Update location.
Update a location info.
Parameters
- id
-
(Integer) – Location id.
- data
-
(Hash) – Data to be submitted.
Example
data = {
title: 'New Location Modified'
}
@data = @cxf_user.update_location(5, data)
66 67 68 |
# File 'lib/user/ecommerce/locations.rb', line 66 def update_location(id, data, = nil) @client.raw('put', "/ecommerce/locations/#{id}", , data_transform(data)) end |
#update_location_template(id, data) ⇒ Object
Update location template.
Update a location template info.
Parameters
- id
-
(Integer) – Location template id.
- data
-
(Hash) – Data to be submitted.
Example
data = {
title: 'New Location Template Modified'
}
@data = @cxf_user.update_location_template(3, data)
168 169 170 |
# File 'lib/user/ecommerce/locations.rb', line 168 def update_location_template(id, data) @client.raw('put', "/ecommerce/location-templates/#{id}", nil, data_transform(data)) end |