Module: Taxonomies
- Included in:
- Config
- Defined in:
- lib/user/config/taxonomies.rb
Instance Method Summary collapse
-
#create_taxonomy(data) ⇒ Object
Create taxonomy.
-
#get_taxonomies(options = nil, use_post = true) ⇒ Object
Get taxonomies.
-
#get_taxonomies_for_object(options) ⇒ Object
Get taxonomies for object.
-
#get_taxonomies_support_data ⇒ Object
Get taxonomies support data.
-
#get_taxonomy(id, options = nil) ⇒ Object
Get taxonomy.
-
#sync_taxonomies_for_object(data) ⇒ Object
Sync taxonomies for object.
-
#update_taxonomy(id, data) ⇒ Object
Update taxonomy.
Instance Method Details
#create_taxonomy(data) ⇒ Object
Create taxonomy.
Create a taxonomy with data.
Parameters
- data
-
(Hash) – Data to be submited.
Example
data = {
"title": "New Taxonomy",
"slug": "new-taxonomy",
"object_type": "contacts"
}
@data = @mints_user.create_taxonomy(data)
103 104 105 |
# File 'lib/user/config/taxonomies.rb', line 103 def create_taxonomy(data) return @client.raw("post", "/config/taxonomies", nil, data_transform(data)) end |
#get_taxonomies(options = nil, use_post = true) ⇒ Object
Get taxonomies.
Get a collection of taxonomies.
Parameters
- options
-
(Hash) – List of Resource Collection Options shown above can be used as parameter.
- use_post
-
(Boolean) – Variable to determine if the request is by ‘post’ or ‘get’ functions.
First Example
@data = @mints_user.get_taxonomies
Second Example
= { "fields": "title" }
@data = @mints_user.get_taxonomies()
Third Example
= { "fields": "title" }
@data = @mints_user.get_taxonomies(, false)
69 70 71 |
# File 'lib/user/config/taxonomies.rb', line 69 def get_taxonomies( = nil, use_post = true) return get_query_results("/config/taxonomies", , use_post) end |
#get_taxonomies_for_object(options) ⇒ Object
Get taxonomies for object.
Get taxonomies for object.
Parameters
- options
-
(Hash) – List of Resource Collection Options shown above can be used as parameter.
Example
= {
"object_type": "contacts",
"object_id": 1
}
@data = @mints_user.get_taxonomies_for_object()
34 35 36 |
# File 'lib/user/config/taxonomies.rb', line 34 def get_taxonomies_for_object() return @client.raw("get", "/config/taxonomies/get_taxonomies_for_object", ) end |
#get_taxonomies_support_data ⇒ Object
Get taxonomies support data.
Get support data used in taxonomies.
Example
@data = @mints_user.get_taxonomies_support_data
43 44 45 |
# File 'lib/user/config/taxonomies.rb', line 43 def get_taxonomies_support_data return @client.raw("get", "/config/taxonomies/support-data") end |
#get_taxonomy(id, options = nil) ⇒ Object
Get taxonomy.
Get a taxonomy info.
Parameters
- id
-
(Integer) – Taxonomy id.
- options
-
(Hash) – List of Resource Collection Options shown above can be used as parameter.
First Example
@data = @mints_user.get_taxonomy(1)
Second Example
= { "fields": "title" }
@data = @mints_user.get_taxonomy(1, )
86 87 88 |
# File 'lib/user/config/taxonomies.rb', line 86 def get_taxonomy(id, = nil) return @client.raw("get", "/config/taxonomies/#{id}", ) end |
#sync_taxonomies_for_object(data) ⇒ Object
Sync taxonomies for object.
Sync taxonomies for object.
Parameters
- data
-
(Hash) – Data to be submited.
Example
data = {
"object_type": "contacts",
"object_id": 1
}
@data = @mints_user.sync_taxonomies_for_object(data)
18 19 20 |
# File 'lib/user/config/taxonomies.rb', line 18 def sync_taxonomies_for_object(data) return @client.raw("put", "/config/taxonomies/sync_taxonomies_for_object", nil, data_transform(data)) end |
#update_taxonomy(id, data) ⇒ Object
Update taxonomy.
Update a taxonomy info.
Parameters
- id
-
(Integer) – Taxonomy id.
- data
-
(Hash) – Data to be submited.
Example
data = {
"title": "New Taxomony Modified",
"slug": "new-taxonomy",
"object_type": "contacts"
}
@data = @mints_user.update_taxonomy(104, data)
121 122 123 |
# File 'lib/user/config/taxonomies.rb', line 121 def update_taxonomy(id, data) return @client.raw("put", "/config/taxonomies/#{id}", nil, data_transform(data)) end |