Module: Attributes

Included in:
Config
Defined in:
lib/user/config/attributes.rb

Instance Method Summary collapse

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)
[View source]

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

#get_attribute(id) ⇒ Object

Get attribute.

Get an attribute info.

Parameters

id

(Integer) – Attribute id.

Example

@data = @mints_user.get_attribute(1)
[View source]

44
45
46
# File 'lib/user/config/attributes.rb', line 44

def get_attribute(id)
    return @client.raw("get", "/config/attributes/#{id}")
end

#get_attributesObject

Get attributes.

Get a collection of attributes.

Example

@data = @mints_user.get_attributes
[View source]

32
33
34
# File 'lib/user/config/attributes.rb', line 32

def get_attributes
    return @client.raw("get", "/config/attributes")
end

#get_attributes_data_typesObject

Get attributes data types.

Get data types used in attributes.

Example

@data = @mints_user.get_attributes_data_types
[View source]

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

#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

[View source]

23
24
25
# File 'lib/user/config/attributes.rb', line 23

def get_sub_attributes(options) #TODO: Test, this method has been added recently
    return @client.raw("get", "/config/attributes/sub-attributes", options)
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)
[View source]

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