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
permalink #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)
63 64 65 |
# File 'lib/user/config/attributes.rb', line 63 def create_attribute(data) return @client.raw("post", "/config/attributes", nil, data_transform(data)) end |
permalink #get_attribute(id) ⇒ Object
Get attribute.
Get an attribute info.
Parameters
- id
-
(Integer) – Attribute id.
Example
@data = @mints_user.get_attribute(1)
44 45 46 |
# File 'lib/user/config/attributes.rb', line 44 def get_attribute(id) return @client.raw("get", "/config/attributes/#{id}") end |
permalink #get_attributes ⇒ Object
Get attributes.
Get a collection of attributes.
Example
@data = @mints_user.get_attributes
32 33 34 |
# File 'lib/user/config/attributes.rb', line 32 def get_attributes return @client.raw("get", "/config/attributes") end |
permalink #get_attributes_data_types ⇒ Object
Get attributes data types.
Get data types used in attributes.
Example
@data = @mints_user.get_attributes_data_types
11 12 13 |
# File 'lib/user/config/attributes.rb', line 11 def get_attributes_data_types return @client.raw("get", "/config/attributes/data-types") end |
permalink #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
23 24 25 |
# File 'lib/user/config/attributes.rb', line 23 def get_sub_attributes() #TODO: Test, this method has been added recently return @client.raw("get", "/config/attributes/sub-attributes", ) end |
permalink #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)
83 84 85 |
# File 'lib/user/config/attributes.rb', line 83 def update_attribute(id, data) return @client.raw("put", "/config/attributes/#{id}", nil, data_transform(data)) end |