Module: Attributes
- Included in:
- Config
- Defined in:
- lib/user/config/attributes.rb
Instance Method Summary collapse
-
#create_attribute(data) ⇒ Object
Create attribute.
-
#get_attribute(id) ⇒ Object
Get attribute.
-
#get_attributes ⇒ Object
Get attributes.
-
#get_attributes_data_types ⇒ Object
Get attributes data types.
-
#get_sub_attributes(options) ⇒ Object
Get sub attributes.
-
#update_attribute(id, data) ⇒ Object
Update attribute.
Instance Method Details
#create_attribute(data) ⇒ Object
Create attribute.
Create an attribute with data.
Parameters
- data
-
(Hash) – Data to be submitted.
Example
data = {
title: "New Attribute",
object_type: "orders",
slug: "new_attribute",
attribute_group_id: 1,
data_type_enum: 10
}
@data = @mints_user.create_attribute(data)
65 66 67 |
# File 'lib/user/config/attributes.rb', line 65 def create_attribute(data) @client.raw('post', '/config/attributes', nil, data_transform(data)) end |
#get_attribute(id) ⇒ Object
Get attribute.
Get an attribute info.
Parameters
- id
-
(Integer) – Attribute id.
Example
@data = @mints_user.get_attribute(1)
46 47 48 |
# File 'lib/user/config/attributes.rb', line 46 def get_attribute(id) @client.raw('get', "/config/attributes/#{id}") end |
#get_attributes ⇒ Object
Get attributes.
Get a collection of attributes.
Example
@data = @mints_user.get_attributes
34 35 36 |
# File 'lib/user/config/attributes.rb', line 34 def get_attributes @client.raw('get', '/config/attributes') end |
#get_attributes_data_types ⇒ Object
Get attributes data types.
Get data types used in attributes.
Example
@data = @mints_user.get_attributes_data_types
13 14 15 |
# File 'lib/user/config/attributes.rb', line 13 def get_attributes_data_types @client.raw('get', '/config/attributes/data-types') end |
#get_sub_attributes(options) ⇒ Object
Get sub attributes.
Get sub attributes with a slug.
Parameters
- options
-
(Hash) – List of Resource Collection Options shown above can be used as parameter.
Example
25 26 27 |
# File 'lib/user/config/attributes.rb', line 25 def get_sub_attributes() @client.raw('get', '/config/attributes/sub-attributes', ) end |
#update_attribute(id, data) ⇒ Object
Update attribute.
Update an attribute info.
Parameters
- id
-
(Integer) – Attribute id.
- data
-
(Hash) – Data to be submitted.
Example
data = {
title: 'New Attribute Modified',
object_type: 'orders',
slug: 'new_attribute',
attribute_group_id: 1,
data_type_enum: 10
}
@data = @mints_user.update_attribute(292, data)
85 86 87 |
# File 'lib/user/config/attributes.rb', line 85 def update_attribute(id, data) @client.raw('put', "/config/attributes/#{id}", nil, data_transform(data)) end |