Class: Mints::User
- Inherits:
-
Object
- Object
- Mints::User
- Defined in:
- lib/user.rb
Overview
User context API
User class contains functions that needs an API key and a session token as authentication
Usage example
Initialize
client = Mints::User.new(mints_url, api_key)
Call any function
client.get_contacts
Single resource options
-
include
- [String] include a relationship -
attributes
- [Boolean] attach attributes to response -
categories
- [Boolean] attach categories to response -
tags
- [Boolean] attach tags to response
Resource collections options
-
search
- [String] filter by a search word -
scopes
- [String] filter by a scope -
filters
- [String] filter by where clauses -
jfilters
- [String] filter using complex condition objects -
catfilters
- [String] filter by categories -
fields
- [String] indicates the columns that will be selected -
sort
- [String] indicates the columns that will be selected -
include
- [String] include a relationship -
attributes
- [Boolean] attach attributes to response -
categories
- [Boolean] attach categories to response -
taxonomies
- [Boolean] attach categories to response -
tags
- [Boolean] attach tags to response
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
Instance Method Summary collapse
- #create_company(data, options = nil) ⇒ Object
- #create_contact(data, options = nil) ⇒ Object
- #create_content_instance(data, options = nil) ⇒ Object
- #create_content_page(data, options = nil) ⇒ Object
- #create_content_template(data, options = nil) ⇒ Object
- #create_deal(data, options = nil) ⇒ Object
- #create_location(data, options = nil) ⇒ Object
- #create_price(data, options = nil) ⇒ Object
- #create_price_list(data, options = nil) ⇒ Object
- #create_prodict_brand(data, options = nil) ⇒ Object
- #create_prodict_template(data, options = nil) ⇒ Object
- #create_prodict_type(data, options = nil) ⇒ Object
- #create_product(data, options = nil) ⇒ Object
- #create_sku(data, options = nil) ⇒ Object
- #create_story(data, options = nil) ⇒ Object
- #create_story_template(data, options = nil) ⇒ Object
- #create_taxonomy(data, options = nil) ⇒ Object
-
#get_companies(options = nil) ⇒ Object
Get companies.
- #get_company(id, options = nil) ⇒ Object
- #get_contact(id, options = nil) ⇒ Object
-
#get_contacts(options = nil) ⇒ Object
CRM #########################################.
- #get_content_instance(id, options = nil) ⇒ Object
-
#get_content_instances(options = nil) ⇒ Object
Get content instances.
- #get_content_page(id, options = nil) ⇒ Object
-
#get_content_pages(options = nil) ⇒ Object
Get content pages.
- #get_content_template(id, options = nil) ⇒ Object
-
#get_content_templates(options = nil) ⇒ Object
Get content templates.
- #get_deal(id, options = nil) ⇒ Object
-
#get_deals(options = nil) ⇒ Object
Get deals.
- #get_location(id, options = nil) ⇒ Object
-
#get_locations(options = nil) ⇒ Object
Get locations.
- #get_price(id, options = nil) ⇒ Object
- #get_price_list(id, options = nil) ⇒ Object
-
#get_price_lists(options = nil) ⇒ Object
Get prece lists.
-
#get_prices(options = nil) ⇒ Object
Get prices.
- #get_prodict_brand(id, options = nil) ⇒ Object
- #get_prodict_template(id, options = nil) ⇒ Object
- #get_prodict_type(id, options = nil) ⇒ Object
- #get_product(id, options = nil) ⇒ Object
-
#get_product_brands(options = nil) ⇒ Object
Get product brands.
-
#get_product_templates(options = nil) ⇒ Object
Get product templates.
-
#get_product_types(options = nil) ⇒ Object
Get product types.
-
#get_products(options = nil) ⇒ Object
Get products.
- #get_sku(id, options = nil) ⇒ Object
-
#get_skus(options = nil) ⇒ Object
Get skus.
-
#get_stories(options = nil) ⇒ Object
Content ######################################### === Get stories.
- #get_story(id, options = nil) ⇒ Object
- #get_story_template(id, options = nil) ⇒ Object
-
#get_story_templates(options = nil) ⇒ Object
Get story templates.
-
#get_taxonomies(options = nil) ⇒ Object
Get taxonomies.
- #get_taxonomy(id, options = nil) ⇒ Object
-
#initialize(host, api_key, session_token = nil, debug = false) ⇒ User
constructor
A new instance of User.
- #login(email, password) ⇒ Object
- #update_company(id, data, options = nil) ⇒ Object
- #update_contact(id, data, options = nil) ⇒ Object
- #update_content_instance(id, data, options = nil) ⇒ Object
- #update_content_page(id, data, options = nil) ⇒ Object
- #update_content_template(id, data, options = nil) ⇒ Object
- #update_deal(id, data, options = nil) ⇒ Object
- #update_location(id, data, options = nil) ⇒ Object
- #update_price(id, data, options = nil) ⇒ Object
- #update_price_list(id, data, options = nil) ⇒ Object
- #update_product(id, data, options = nil) ⇒ Object
- #update_product_brand(id, data, options = nil) ⇒ Object
- #update_product_template(id, data, options = nil) ⇒ Object
- #update_product_type(id, data, options = nil) ⇒ Object
- #update_sku(id, data, options = nil) ⇒ Object
- #update_story(id, data, options = nil) ⇒ Object
- #update_story_template(id, data, options = nil) ⇒ Object
- #update_taxonomy(id, data, options = nil) ⇒ Object
Constructor Details
permalink #initialize(host, api_key, session_token = nil, debug = false) ⇒ User
Returns a new instance of User.
31 32 33 |
# File 'lib/user.rb', line 31 def initialize(host, api_key, session_token = nil, debug = false) @client = Mints::Client.new(host, api_key, 'user', session_token, debug) end |
Instance Attribute Details
permalink #client ⇒ Object (readonly)
Returns the value of attribute client.
30 31 32 |
# File 'lib/user.rb', line 30 def client @client end |
Instance Method Details
permalink #create_company(data, options = nil) ⇒ Object
[View source]
82 83 84 |
# File 'lib/user.rb', line 82 def create_company(data, = nil) return @client.create__crm__companies(data, ) end |
permalink #create_contact(data, options = nil) ⇒ Object
[View source]
61 62 63 |
# File 'lib/user.rb', line 61 def create_contact(data, = nil) return @client.create__crm__contacts(data, ) end |
permalink #create_content_instance(data, options = nil) ⇒ Object
[View source]
167 168 169 |
# File 'lib/user.rb', line 167 def create_content_instance(data, = nil) return @client.create__content__instances(data, ) end |
permalink #create_content_page(data, options = nil) ⇒ Object
[View source]
188 189 190 |
# File 'lib/user.rb', line 188 def create_content_page(data, = nil) return @client.create__content__pages(data, ) end |
permalink #create_content_template(data, options = nil) ⇒ Object
[View source]
209 210 211 |
# File 'lib/user.rb', line 209 def create_content_template(data, = nil) return @client.create__content__templates(data, ) end |
permalink #create_deal(data, options = nil) ⇒ Object
[View source]
103 104 105 |
# File 'lib/user.rb', line 103 def create_deal(data, = nil) return @client.create__crm__deals(data, ) end |
permalink #create_location(data, options = nil) ⇒ Object
[View source]
378 379 380 |
# File 'lib/user.rb', line 378 def create_location(data, = nil) return @client.create__ecommerce__locations(data, ) end |
permalink #create_price(data, options = nil) ⇒ Object
[View source]
272 273 274 |
# File 'lib/user.rb', line 272 def create_price(data, = nil) return @client.create__ecommerce__prices(data, ) end |
permalink #create_price_list(data, options = nil) ⇒ Object
[View source]
293 294 295 |
# File 'lib/user.rb', line 293 def create_price_list(data, = nil) return @client.create__ecommerce__price_lists(data, ) end |
permalink #create_prodict_brand(data, options = nil) ⇒ Object
[View source]
314 315 316 |
# File 'lib/user.rb', line 314 def create_prodict_brand(data, = nil) return @client.create__ecommerce__product_brands(data, ) end |
permalink #create_prodict_template(data, options = nil) ⇒ Object
[View source]
356 357 358 |
# File 'lib/user.rb', line 356 def create_prodict_template(data, = nil) return @client.create__ecommerce__product_templates(data, ) end |
permalink #create_prodict_type(data, options = nil) ⇒ Object
[View source]
335 336 337 |
# File 'lib/user.rb', line 335 def create_prodict_type(data, = nil) return @client.create__ecommerce__product_types(data, ) end |
permalink #create_product(data, options = nil) ⇒ Object
[View source]
230 231 232 |
# File 'lib/user.rb', line 230 def create_product(data, = nil) return @client.create__ecommerce__products(data, ) end |
permalink #create_sku(data, options = nil) ⇒ Object
[View source]
251 252 253 |
# File 'lib/user.rb', line 251 def create_sku(data, = nil) return @client.create__ecommerce__skus(data, ) end |
permalink #create_story(data, options = nil) ⇒ Object
[View source]
125 126 127 |
# File 'lib/user.rb', line 125 def create_story(data, = nil) return @client.create__content__stories(data, ) end |
permalink #create_story_template(data, options = nil) ⇒ Object
[View source]
146 147 148 |
# File 'lib/user.rb', line 146 def create_story_template(data, = nil) return @client.create__content__story_templates(data, ) end |
permalink #create_taxonomy(data, options = nil) ⇒ Object
[View source]
399 400 401 |
# File 'lib/user.rb', line 399 def create_taxonomy(data, = nil) return @client.create__config__taxonomies(data, ) end |
permalink #get_companies(options = nil) ⇒ Object
Get companies.
Get a collection of companies
Parameters
-
options
- [Hash] List of Resource collection Options shown above can be used as parameter
74 75 76 |
# File 'lib/user.rb', line 74 def get_companies( = nil) return @client.get__crm__companies() end |
permalink #get_company(id, options = nil) ⇒ Object
[View source]
78 79 80 |
# File 'lib/user.rb', line 78 def get_company(id, = nil) return @client.get__crm__companies(id, ) end |
permalink #get_contact(id, options = nil) ⇒ Object
[View source]
57 58 59 |
# File 'lib/user.rb', line 57 def get_contact(id, = nil) return @client.get__crm__contacts(id, ) end |
permalink #get_contacts(options = nil) ⇒ Object
CRM #########################################
Get contacts.
Get a collection of contacts
Parameters
-
options
- [Hash] List of Resource collection Options shown above can be used as parameter
53 54 55 |
# File 'lib/user.rb', line 53 def get_contacts( = nil) return @client.get__crm__contacts() end |
permalink #get_content_instance(id, options = nil) ⇒ Object
[View source]
163 164 165 |
# File 'lib/user.rb', line 163 def get_content_instance(id, = nil) return @client.get__content__instances(id, ) end |
permalink #get_content_instances(options = nil) ⇒ Object
Get content instances.
Get a collection of content instances
Parameters
-
options
- [Hash] List of Resource collection Options shown above can be used as parameter
159 160 161 |
# File 'lib/user.rb', line 159 def get_content_instances( = nil) return @client.get__content__instances() end |
permalink #get_content_page(id, options = nil) ⇒ Object
[View source]
184 185 186 |
# File 'lib/user.rb', line 184 def get_content_page(id, = nil) return @client.get__content__pages(id, ) end |
permalink #get_content_pages(options = nil) ⇒ Object
Get content pages.
Get a collection of content pages
Parameters
-
options
- [Hash] List of Resource collection Options shown above can be used as parameter
180 181 182 |
# File 'lib/user.rb', line 180 def get_content_pages( = nil) return @client.get__content__pages() end |
permalink #get_content_template(id, options = nil) ⇒ Object
[View source]
205 206 207 |
# File 'lib/user.rb', line 205 def get_content_template(id, = nil) return @client.get__content__templates(id, ) end |
permalink #get_content_templates(options = nil) ⇒ Object
Get content templates.
Get a collection of content templates
Parameters
-
options
- [Hash] List of Resource collection Options shown above can be used as parameter
201 202 203 |
# File 'lib/user.rb', line 201 def get_content_templates( = nil) return @client.get__content__templates() end |
permalink #get_deal(id, options = nil) ⇒ Object
[View source]
99 100 101 |
# File 'lib/user.rb', line 99 def get_deal(id, = nil) return @client.get__crm__deals(id, ) end |
permalink #get_deals(options = nil) ⇒ Object
Get deals.
Get a collection of deals
Parameters
-
options
- [Hash] List of Resource collection Options shown above can be used as parameter
95 96 97 |
# File 'lib/user.rb', line 95 def get_deals( = nil) return @client.get__crm__deals() end |
permalink #get_location(id, options = nil) ⇒ Object
[View source]
374 375 376 |
# File 'lib/user.rb', line 374 def get_location(id, = nil) return @client.get__ecommerce__locations(id, ) end |
permalink #get_locations(options = nil) ⇒ Object
Get locations.
Get a collection of locations
Parameters
-
options
- [Hash] List of Resource collection Options shown above can be used as parameter
370 371 372 |
# File 'lib/user.rb', line 370 def get_locations( = nil) return @client.get__ecommerce__locations() end |
permalink #get_price(id, options = nil) ⇒ Object
[View source]
268 269 270 |
# File 'lib/user.rb', line 268 def get_price(id, = nil) return @client.get__ecommerce__prices(id, ) end |
permalink #get_price_list(id, options = nil) ⇒ Object
[View source]
289 290 291 |
# File 'lib/user.rb', line 289 def get_price_list(id, = nil) return @client.get__ecommerce__price_lists(id, ) end |
permalink #get_price_lists(options = nil) ⇒ Object
Get prece lists.
Get a collection of prece lists
Parameters
-
options
- [Hash] List of Resource collection Options shown above can be used as parameter
285 286 287 |
# File 'lib/user.rb', line 285 def get_price_lists( = nil) return @client.get__ecommerce__price_lists() end |
permalink #get_prices(options = nil) ⇒ Object
Get prices.
Get a collection of prices
Parameters
-
options
- [Hash] List of Resource collection Options shown above can be used as parameter
264 265 266 |
# File 'lib/user.rb', line 264 def get_prices( = nil) return @client.get__ecommerce__prices() end |
permalink #get_prodict_brand(id, options = nil) ⇒ Object
[View source]
310 311 312 |
# File 'lib/user.rb', line 310 def get_prodict_brand(id, = nil) return @client.get__ecommerce__product_brands(id, ) end |
permalink #get_prodict_template(id, options = nil) ⇒ Object
[View source]
352 353 354 |
# File 'lib/user.rb', line 352 def get_prodict_template(id, = nil) return @client.get__ecommerce__product_templates(id, ) end |
permalink #get_prodict_type(id, options = nil) ⇒ Object
[View source]
331 332 333 |
# File 'lib/user.rb', line 331 def get_prodict_type(id, = nil) return @client.get__ecommerce__product_types(id, ) end |
permalink #get_product(id, options = nil) ⇒ Object
[View source]
226 227 228 |
# File 'lib/user.rb', line 226 def get_product(id, = nil) return @client.get__ecommerce__products(id, ) end |
permalink #get_product_brands(options = nil) ⇒ Object
Get product brands.
Get a collection of product brands
Parameters
-
options
- [Hash] List of Resource collection Options shown above can be used as parameter
306 307 308 |
# File 'lib/user.rb', line 306 def get_product_brands( = nil) return @client.get__ecommerce__product_brands() end |
permalink #get_product_templates(options = nil) ⇒ Object
Get product templates.
Get a collection of product templates
Parameters
-
options
- [Hash] List of Resource collection Options shown above can be used as parameter
348 349 350 |
# File 'lib/user.rb', line 348 def get_product_templates( = nil) return @client.get__ecommerce__product_templates() end |
permalink #get_product_types(options = nil) ⇒ Object
Get product types.
Get a collection of product types
Parameters
-
options
- [Hash] List of Resource collection Options shown above can be used as parameter
327 328 329 |
# File 'lib/user.rb', line 327 def get_product_types( = nil) return @client.get__ecommerce__product_types() end |
permalink #get_products(options = nil) ⇒ Object
Get products.
Get a collection of products
Parameters
-
options
- [Hash] List of Resource collection Options shown above can be used as parameter
222 223 224 |
# File 'lib/user.rb', line 222 def get_products( = nil) return @client.get__ecommerce__products() end |
permalink #get_sku(id, options = nil) ⇒ Object
[View source]
247 248 249 |
# File 'lib/user.rb', line 247 def get_sku(id, = nil) return @client.get__ecommerce__skus(id, ) end |
permalink #get_skus(options = nil) ⇒ Object
Get skus.
Get a collection of skus
Parameters
-
options
- [Hash] List of Resource collection Options shown above can be used as parameter
243 244 245 |
# File 'lib/user.rb', line 243 def get_skus( = nil) return @client.get__ecommerce__skus() end |
permalink #get_stories(options = nil) ⇒ Object
Content #########################################
Get stories.
Get a collection of stories
Parameters
-
options
- [Hash] List of Resource collection Options shown above can be used as parameter
117 118 119 |
# File 'lib/user.rb', line 117 def get_stories( = nil) return @client.get__content__stories() end |
permalink #get_story(id, options = nil) ⇒ Object
[View source]
121 122 123 |
# File 'lib/user.rb', line 121 def get_story(id, = nil) return @client.get__content__stories(id, ) end |
permalink #get_story_template(id, options = nil) ⇒ Object
[View source]
142 143 144 |
# File 'lib/user.rb', line 142 def get_story_template(id, = nil) return @client.get__content__story_templates(id, ) end |
permalink #get_story_templates(options = nil) ⇒ Object
Get story templates.
Get a collection of story templates
Parameters
-
options
- [Hash] List of Resource collection Options shown above can be used as parameter
138 139 140 |
# File 'lib/user.rb', line 138 def get_story_templates( = nil) return @client.get__content__story_templates() end |
permalink #get_taxonomies(options = nil) ⇒ Object
Get taxonomies.
Get a collection of taxonomies
Parameters
-
options
- [Hash] List of Resource collection Options shown above can be used as parameter
391 392 393 |
# File 'lib/user.rb', line 391 def get_taxonomies( = nil) return @client.get__config__taxonomies() end |
permalink #get_taxonomy(id, options = nil) ⇒ Object
[View source]
395 396 397 |
# File 'lib/user.rb', line 395 def get_taxonomy(id, = nil) return @client.get__config__taxonomies(id, ) end |
permalink #login(email, password) ⇒ Object
[View source]
35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/user.rb', line 35 def login(email, password) data = { email: email, password: password, } response = @client.raw("post", "/users/login", nil, data, '/api/v1') if response.key? "api_token" @client.session_token = response["api_token"] end return response end |
permalink #update_company(id, data, options = nil) ⇒ Object
[View source]
86 87 88 |
# File 'lib/user.rb', line 86 def update_company(id, data, = nil) return @client.update__crm__companies(id, data, ) end |
permalink #update_contact(id, data, options = nil) ⇒ Object
[View source]
65 66 67 |
# File 'lib/user.rb', line 65 def update_contact(id, data, = nil) return @client.update__crm__contacts(id, data, ) end |
permalink #update_content_instance(id, data, options = nil) ⇒ Object
[View source]
171 172 173 |
# File 'lib/user.rb', line 171 def update_content_instance(id, data, = nil) return @client.update__content__instances(id, data, ) end |
permalink #update_content_page(id, data, options = nil) ⇒ Object
[View source]
192 193 194 |
# File 'lib/user.rb', line 192 def update_content_page(id, data, = nil) return @client.update__content__pages(id, data, ) end |
permalink #update_content_template(id, data, options = nil) ⇒ Object
[View source]
213 214 215 |
# File 'lib/user.rb', line 213 def update_content_template(id, data, = nil) return @client.update__content__templates(id, data, ) end |
permalink #update_deal(id, data, options = nil) ⇒ Object
[View source]
107 108 109 |
# File 'lib/user.rb', line 107 def update_deal(id, data, = nil) return @client.update__crm__deals(id, data, ) end |
permalink #update_location(id, data, options = nil) ⇒ Object
[View source]
382 383 384 |
# File 'lib/user.rb', line 382 def update_location(id, data, = nil) return @client.update__ecommerce__locations(id, data, ) end |
permalink #update_price(id, data, options = nil) ⇒ Object
[View source]
276 277 278 |
# File 'lib/user.rb', line 276 def update_price(id, data, = nil) return @client.update__ecommerce__prices(id, data, ) end |
permalink #update_price_list(id, data, options = nil) ⇒ Object
[View source]
297 298 299 |
# File 'lib/user.rb', line 297 def update_price_list(id, data, = nil) return @client.update__ecommerce__price_lists(id, data, ) end |
permalink #update_product(id, data, options = nil) ⇒ Object
[View source]
234 235 236 |
# File 'lib/user.rb', line 234 def update_product(id, data, = nil) return @client.update__ecommerce__products(id, data, ) end |
permalink #update_product_brand(id, data, options = nil) ⇒ Object
[View source]
318 319 320 |
# File 'lib/user.rb', line 318 def update_product_brand(id, data, = nil) return @client.update__ecommerce__product_brands(id, data, ) end |
permalink #update_product_template(id, data, options = nil) ⇒ Object
[View source]
360 361 362 |
# File 'lib/user.rb', line 360 def update_product_template(id, data, = nil) return @client.update__ecommerce__product_templates(id, data, ) end |
permalink #update_product_type(id, data, options = nil) ⇒ Object
[View source]
339 340 341 |
# File 'lib/user.rb', line 339 def update_product_type(id, data, = nil) return @client.update__ecommerce__product_types(id, data, ) end |
permalink #update_sku(id, data, options = nil) ⇒ Object
[View source]
255 256 257 |
# File 'lib/user.rb', line 255 def update_sku(id, data, = nil) return @client.update__ecommerce__skus(id, data, ) end |
permalink #update_story(id, data, options = nil) ⇒ Object
[View source]
129 130 131 |
# File 'lib/user.rb', line 129 def update_story(id, data, = nil) return @client.update__content__stories(id, data, ) end |
permalink #update_story_template(id, data, options = nil) ⇒ Object
[View source]
150 151 152 |
# File 'lib/user.rb', line 150 def update_story_template(id, data, = nil) return @client.update__content__story_templates(id, data, ) end |
permalink #update_taxonomy(id, data, options = nil) ⇒ Object
[View source]
403 404 405 |
# File 'lib/user.rb', line 403 def update_taxonomy(id, data, = nil) return @client.update__config__taxonomies(id, data, ) end |