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
- #magic_link_login(token) ⇒ Object
-
#me ⇒ Object
Me.
-
#send_magic_link(email, redirectUrl = '', lifeTime = 24) ⇒ Object
Send magic link to user.
- #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
Instance Attribute Details
#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
#create_company(data, options = nil) ⇒ Object
107 108 109 |
# File 'lib/user.rb', line 107 def create_company(data, = nil) return @client.create__crm__companies(data, ) end |
#create_contact(data, options = nil) ⇒ Object
86 87 88 |
# File 'lib/user.rb', line 86 def create_contact(data, = nil) return @client.create__crm__contacts(data, ) end |
#create_content_instance(data, options = nil) ⇒ Object
192 193 194 |
# File 'lib/user.rb', line 192 def create_content_instance(data, = nil) return @client.create__content__instances(data, ) end |
#create_content_page(data, options = nil) ⇒ Object
213 214 215 |
# File 'lib/user.rb', line 213 def create_content_page(data, = nil) return @client.create__content__pages(data, ) end |
#create_content_template(data, options = nil) ⇒ Object
234 235 236 |
# File 'lib/user.rb', line 234 def create_content_template(data, = nil) return @client.create__content__templates(data, ) end |
#create_deal(data, options = nil) ⇒ Object
128 129 130 |
# File 'lib/user.rb', line 128 def create_deal(data, = nil) return @client.create__crm__deals(data, ) end |
#create_location(data, options = nil) ⇒ Object
403 404 405 |
# File 'lib/user.rb', line 403 def create_location(data, = nil) return @client.create__ecommerce__locations(data, ) end |
#create_price(data, options = nil) ⇒ Object
297 298 299 |
# File 'lib/user.rb', line 297 def create_price(data, = nil) return @client.create__ecommerce__prices(data, ) end |
#create_price_list(data, options = nil) ⇒ Object
318 319 320 |
# File 'lib/user.rb', line 318 def create_price_list(data, = nil) return @client.create__ecommerce__price_lists(data, ) end |
#create_prodict_brand(data, options = nil) ⇒ Object
339 340 341 |
# File 'lib/user.rb', line 339 def create_prodict_brand(data, = nil) return @client.create__ecommerce__product_brands(data, ) end |
#create_prodict_template(data, options = nil) ⇒ Object
381 382 383 |
# File 'lib/user.rb', line 381 def create_prodict_template(data, = nil) return @client.create__ecommerce__product_templates(data, ) end |
#create_prodict_type(data, options = nil) ⇒ Object
360 361 362 |
# File 'lib/user.rb', line 360 def create_prodict_type(data, = nil) return @client.create__ecommerce__product_types(data, ) end |
#create_product(data, options = nil) ⇒ Object
255 256 257 |
# File 'lib/user.rb', line 255 def create_product(data, = nil) return @client.create__ecommerce__products(data, ) end |
#create_sku(data, options = nil) ⇒ Object
276 277 278 |
# File 'lib/user.rb', line 276 def create_sku(data, = nil) return @client.create__ecommerce__skus(data, ) end |
#create_story(data, options = nil) ⇒ Object
150 151 152 |
# File 'lib/user.rb', line 150 def create_story(data, = nil) return @client.create__content__stories(data, ) end |
#create_story_template(data, options = nil) ⇒ Object
171 172 173 |
# File 'lib/user.rb', line 171 def create_story_template(data, = nil) return @client.create__content__story_templates(data, ) end |
#create_taxonomy(data, options = nil) ⇒ Object
424 425 426 |
# File 'lib/user.rb', line 424 def create_taxonomy(data, = nil) return @client.create__config__taxonomies(data, ) end |
#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
99 100 101 |
# File 'lib/user.rb', line 99 def get_companies( = nil) return @client.get__crm__companies() end |
#get_company(id, options = nil) ⇒ Object
103 104 105 |
# File 'lib/user.rb', line 103 def get_company(id, = nil) return @client.get__crm__companies(id, ) end |
#get_contact(id, options = nil) ⇒ Object
82 83 84 |
# File 'lib/user.rb', line 82 def get_contact(id, = nil) return @client.get__crm__contacts(id, ) end |
#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
78 79 80 |
# File 'lib/user.rb', line 78 def get_contacts( = nil) return @client.get__crm__contacts() end |
#get_content_instance(id, options = nil) ⇒ Object
188 189 190 |
# File 'lib/user.rb', line 188 def get_content_instance(id, = nil) return @client.get__content__instances(id, ) end |
#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
184 185 186 |
# File 'lib/user.rb', line 184 def get_content_instances( = nil) return @client.get__content__instances() end |
#get_content_page(id, options = nil) ⇒ Object
209 210 211 |
# File 'lib/user.rb', line 209 def get_content_page(id, = nil) return @client.get__content__pages(id, ) end |
#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
205 206 207 |
# File 'lib/user.rb', line 205 def get_content_pages( = nil) return @client.get__content__pages() end |
#get_content_template(id, options = nil) ⇒ Object
230 231 232 |
# File 'lib/user.rb', line 230 def get_content_template(id, = nil) return @client.get__content__templates(id, ) end |
#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
226 227 228 |
# File 'lib/user.rb', line 226 def get_content_templates( = nil) return @client.get__content__templates() end |
#get_deal(id, options = nil) ⇒ Object
124 125 126 |
# File 'lib/user.rb', line 124 def get_deal(id, = nil) return @client.get__crm__deals(id, ) end |
#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
120 121 122 |
# File 'lib/user.rb', line 120 def get_deals( = nil) return @client.get__crm__deals() end |
#get_location(id, options = nil) ⇒ Object
399 400 401 |
# File 'lib/user.rb', line 399 def get_location(id, = nil) return @client.get__ecommerce__locations(id, ) end |
#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
395 396 397 |
# File 'lib/user.rb', line 395 def get_locations( = nil) return @client.get__ecommerce__locations() end |
#get_price(id, options = nil) ⇒ Object
293 294 295 |
# File 'lib/user.rb', line 293 def get_price(id, = nil) return @client.get__ecommerce__prices(id, ) end |
#get_price_list(id, options = nil) ⇒ Object
314 315 316 |
# File 'lib/user.rb', line 314 def get_price_list(id, = nil) return @client.get__ecommerce__price_lists(id, ) end |
#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
310 311 312 |
# File 'lib/user.rb', line 310 def get_price_lists( = nil) return @client.get__ecommerce__price_lists() end |
#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
289 290 291 |
# File 'lib/user.rb', line 289 def get_prices( = nil) return @client.get__ecommerce__prices() end |
#get_prodict_brand(id, options = nil) ⇒ Object
335 336 337 |
# File 'lib/user.rb', line 335 def get_prodict_brand(id, = nil) return @client.get__ecommerce__product_brands(id, ) end |
#get_prodict_template(id, options = nil) ⇒ Object
377 378 379 |
# File 'lib/user.rb', line 377 def get_prodict_template(id, = nil) return @client.get__ecommerce__product_templates(id, ) end |
#get_prodict_type(id, options = nil) ⇒ Object
356 357 358 |
# File 'lib/user.rb', line 356 def get_prodict_type(id, = nil) return @client.get__ecommerce__product_types(id, ) end |
#get_product(id, options = nil) ⇒ Object
251 252 253 |
# File 'lib/user.rb', line 251 def get_product(id, = nil) return @client.get__ecommerce__products(id, ) end |
#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
331 332 333 |
# File 'lib/user.rb', line 331 def get_product_brands( = nil) return @client.get__ecommerce__product_brands() end |
#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
373 374 375 |
# File 'lib/user.rb', line 373 def get_product_templates( = nil) return @client.get__ecommerce__product_templates() end |
#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
352 353 354 |
# File 'lib/user.rb', line 352 def get_product_types( = nil) return @client.get__ecommerce__product_types() end |
#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
247 248 249 |
# File 'lib/user.rb', line 247 def get_products( = nil) return @client.get__ecommerce__products() end |
#get_sku(id, options = nil) ⇒ Object
272 273 274 |
# File 'lib/user.rb', line 272 def get_sku(id, = nil) return @client.get__ecommerce__skus(id, ) end |
#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
268 269 270 |
# File 'lib/user.rb', line 268 def get_skus( = nil) return @client.get__ecommerce__skus() end |
#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
142 143 144 |
# File 'lib/user.rb', line 142 def get_stories( = nil) return @client.get__content__stories() end |
#get_story(id, options = nil) ⇒ Object
146 147 148 |
# File 'lib/user.rb', line 146 def get_story(id, = nil) return @client.get__content__stories(id, ) end |
#get_story_template(id, options = nil) ⇒ Object
167 168 169 |
# File 'lib/user.rb', line 167 def get_story_template(id, = nil) return @client.get__content__story_templates(id, ) end |
#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
163 164 165 |
# File 'lib/user.rb', line 163 def get_story_templates( = nil) return @client.get__content__story_templates() end |
#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
416 417 418 |
# File 'lib/user.rb', line 416 def get_taxonomies( = nil) return @client.get__config__taxonomies() end |
#get_taxonomy(id, options = nil) ⇒ Object
420 421 422 |
# File 'lib/user.rb', line 420 def get_taxonomy(id, = nil) return @client.get__config__taxonomies(id, ) end |
#login(email, password) ⇒ Object
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 |
#magic_link_login(token) ⇒ Object
47 48 49 50 |
# File 'lib/user.rb', line 47 def magic_link_login(token) response = @client.raw("get", "/users/magic-link-login/#{token}", nil, nil, '/api/v1') return response end |
#me ⇒ Object
Me.
Get contact logged info
68 69 70 |
# File 'lib/user.rb', line 68 def me return @client.get__profile__me end |
#send_magic_link(email, redirectUrl = '', lifeTime = 24) ⇒ Object
Send magic link to user
54 55 56 57 58 59 60 61 62 |
# File 'lib/user.rb', line 54 def send_magic_link(email, redirectUrl = '', lifeTime = 24) data = { email: email, redirectUrl: redirectUrl, lifeTime: lifeTime } response = @client.raw("post", "/users/magic-link", nil, { data: data }, '/api/v1') return response end |
#update_company(id, data, options = nil) ⇒ Object
111 112 113 |
# File 'lib/user.rb', line 111 def update_company(id, data, = nil) return @client.update__crm__companies(id, data, ) end |
#update_contact(id, data, options = nil) ⇒ Object
90 91 92 |
# File 'lib/user.rb', line 90 def update_contact(id, data, = nil) return @client.update__crm__contacts(id, data, ) end |
#update_content_instance(id, data, options = nil) ⇒ Object
196 197 198 |
# File 'lib/user.rb', line 196 def update_content_instance(id, data, = nil) return @client.update__content__instances(id, data, ) end |
#update_content_page(id, data, options = nil) ⇒ Object
217 218 219 |
# File 'lib/user.rb', line 217 def update_content_page(id, data, = nil) return @client.update__content__pages(id, data, ) end |
#update_content_template(id, data, options = nil) ⇒ Object
238 239 240 |
# File 'lib/user.rb', line 238 def update_content_template(id, data, = nil) return @client.update__content__templates(id, data, ) end |
#update_deal(id, data, options = nil) ⇒ Object
132 133 134 |
# File 'lib/user.rb', line 132 def update_deal(id, data, = nil) return @client.update__crm__deals(id, data, ) end |
#update_location(id, data, options = nil) ⇒ Object
407 408 409 |
# File 'lib/user.rb', line 407 def update_location(id, data, = nil) return @client.update__ecommerce__locations(id, data, ) end |
#update_price(id, data, options = nil) ⇒ Object
301 302 303 |
# File 'lib/user.rb', line 301 def update_price(id, data, = nil) return @client.update__ecommerce__prices(id, data, ) end |
#update_price_list(id, data, options = nil) ⇒ Object
322 323 324 |
# File 'lib/user.rb', line 322 def update_price_list(id, data, = nil) return @client.update__ecommerce__price_lists(id, data, ) end |
#update_product(id, data, options = nil) ⇒ Object
259 260 261 |
# File 'lib/user.rb', line 259 def update_product(id, data, = nil) return @client.update__ecommerce__products(id, data, ) end |
#update_product_brand(id, data, options = nil) ⇒ Object
343 344 345 |
# File 'lib/user.rb', line 343 def update_product_brand(id, data, = nil) return @client.update__ecommerce__product_brands(id, data, ) end |
#update_product_template(id, data, options = nil) ⇒ Object
385 386 387 |
# File 'lib/user.rb', line 385 def update_product_template(id, data, = nil) return @client.update__ecommerce__product_templates(id, data, ) end |
#update_product_type(id, data, options = nil) ⇒ Object
364 365 366 |
# File 'lib/user.rb', line 364 def update_product_type(id, data, = nil) return @client.update__ecommerce__product_types(id, data, ) end |
#update_sku(id, data, options = nil) ⇒ Object
280 281 282 |
# File 'lib/user.rb', line 280 def update_sku(id, data, = nil) return @client.update__ecommerce__skus(id, data, ) end |
#update_story(id, data, options = nil) ⇒ Object
154 155 156 |
# File 'lib/user.rb', line 154 def update_story(id, data, = nil) return @client.update__content__stories(id, data, ) end |
#update_story_template(id, data, options = nil) ⇒ Object
175 176 177 |
# File 'lib/user.rb', line 175 def update_story_template(id, data, = nil) return @client.update__content__story_templates(id, data, ) end |
#update_taxonomy(id, data, options = nil) ⇒ Object
428 429 430 |
# File 'lib/user.rb', line 428 def update_taxonomy(id, data, = nil) return @client.update__config__taxonomies(id, data, ) end |