Class: Mints::User

Inherits:
Object
  • Object
show all
Defined in:
lib/user.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(host, api_key, session_token = nil) ⇒ User

Returns a new instance of User.



5
6
7
# File 'lib/user.rb', line 5

def initialize(host, api_key, session_token = nil)
  @client = Mints::Client.new(host, api_key, 'user', session_token)
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



4
5
6
# File 'lib/user.rb', line 4

def client
  @client
end

Instance Method Details

#create_company(data, options = nil) ⇒ Object



46
47
48
# File 'lib/user.rb', line 46

def create_company(data, options = nil)
  return @client.create__crm__companies(data, options)
end

#create_contact(data, options = nil) ⇒ Object



30
31
32
# File 'lib/user.rb', line 30

def create_contact(data, options = nil)
  return @client.create__crm__contacts(data, options)
end

#create_content_instance(data, options = nil) ⇒ Object



115
116
117
# File 'lib/user.rb', line 115

def create_content_instance(data, options = nil)
  return @client.create__content__instances(data, options)
end

#create_content_page(data, options = nil) ⇒ Object



132
133
134
# File 'lib/user.rb', line 132

def create_content_page(data, options = nil)
  return @client.create__content__pages(data, options)
end

#create_deal(data, options = nil) ⇒ Object



63
64
65
# File 'lib/user.rb', line 63

def create_deal(data, options = nil)
  return @client.create__crm__deals(data, options)
end

#create_location(data, options = nil) ⇒ Object



287
288
289
# File 'lib/user.rb', line 287

def create_location(data, options = nil)
  return @client.create__ecommerce__locations(data, options)
end

#create_price(data, options = nil) ⇒ Object



201
202
203
# File 'lib/user.rb', line 201

def create_price(data, options = nil)
  return @client.create__ecommerce__prices(data, options)
end

#create_price_list(data, options = nil) ⇒ Object



218
219
220
# File 'lib/user.rb', line 218

def create_price_list(data, options = nil)
  return @client.create__ecommerce__price_lists(data, options)
end

#create_prodict_brand(data, options = nil) ⇒ Object



235
236
237
# File 'lib/user.rb', line 235

def create_prodict_brand(data, options = nil)
  return @client.create__ecommerce__product_brands(data, options)
end

#create_prodict_template(data, options = nil) ⇒ Object



269
270
271
# File 'lib/user.rb', line 269

def create_prodict_template(data, options = nil)
  return @client.create__ecommerce__product_templates(data, options)
end

#create_prodict_type(data, options = nil) ⇒ Object



252
253
254
# File 'lib/user.rb', line 252

def create_prodict_type(data, options = nil)
  return @client.create__ecommerce__product_types(data, options)
end

#create_product(data, options = nil) ⇒ Object



167
168
169
# File 'lib/user.rb', line 167

def create_product(data, options = nil)
  return @client.create__ecommerce__products(data, options)
end

#create_sku(data, options = nil) ⇒ Object



184
185
186
# File 'lib/user.rb', line 184

def create_sku(data, options = nil)
  return @client.create__ecommerce__skus(data, options)
end

#create_story(data, options = nil) ⇒ Object



81
82
83
# File 'lib/user.rb', line 81

def create_story(data, options = nil)
  return @client.create__content__stories(data, options)
end

#create_story_template(data, options = nil) ⇒ Object



98
99
100
# File 'lib/user.rb', line 98

def create_story_template(data, options = nil)
  return @client.create__content__story_templates(data, options)
end

#get_companies(options = nil) ⇒ Object

Companies ###



38
39
40
# File 'lib/user.rb', line 38

def get_companies(options = nil)
  return @client.get__crm__companies(options)
end

#get_company(id, options = nil) ⇒ Object



42
43
44
# File 'lib/user.rb', line 42

def get_company(id, options = nil)
  return @client.get__crm__companies(id, options)
end

#get_contact(id, options = nil) ⇒ Object



26
27
28
# File 'lib/user.rb', line 26

def get_contact(id, options = nil)
  return @client.get__crm__contacts(id, options)
end

#get_contacts(options = nil) ⇒ Object

CRM ######################################### Contacts ###



22
23
24
# File 'lib/user.rb', line 22

def get_contacts(options = nil)
  return @client.get__crm__contacts(options)
end

#get_content_instance(id, options = nil) ⇒ Object



111
112
113
# File 'lib/user.rb', line 111

def get_content_instance(id, options = nil)
  return @client.get__content__instances(id, options)
end

#get_content_instances(options = nil) ⇒ Object

Content instances ###



107
108
109
# File 'lib/user.rb', line 107

def get_content_instances(options = nil)
  return @client.get__content__instances(options)
end

#get_content_page(id, options = nil) ⇒ Object



128
129
130
# File 'lib/user.rb', line 128

def get_content_page(id, options = nil)
  return @client.get__content__pages(id, options)
end

#get_content_pages(options = nil) ⇒ Object

Content pages ###



124
125
126
# File 'lib/user.rb', line 124

def get_content_pages(options = nil)
  return @client.get__content__pages(options)
end

#get_content_templates(options = nil) ⇒ Object

Content templates ###



141
142
143
# File 'lib/user.rb', line 141

def get_content_templates(options = nil)
  return @client.get__content__templates(options)
end

#get_deal(id, options = nil) ⇒ Object



59
60
61
# File 'lib/user.rb', line 59

def get_deal(id, options = nil)
  return @client.get__crm__deals(id, options)
end

#get_deals(options = nil) ⇒ Object

Deals ###



55
56
57
# File 'lib/user.rb', line 55

def get_deals(options = nil)
  return @client.get__crm__deals(options)
end

#get_location(id, options = nil) ⇒ Object



283
284
285
# File 'lib/user.rb', line 283

def get_location(id, options = nil)
  return @client.get__ecommerce__locations(id, options)
end

#get_locations(options = nil) ⇒ Object

Locations ###



279
280
281
# File 'lib/user.rb', line 279

def get_locations(options = nil)
  return @client.get__ecommerce__locations(options)
end

#get_price(id, options = nil) ⇒ Object



197
198
199
# File 'lib/user.rb', line 197

def get_price(id, options = nil)
  return @client.get__ecommerce__prices(id, options)
end

#get_price_list(id, options = nil) ⇒ Object



214
215
216
# File 'lib/user.rb', line 214

def get_price_list(id, options = nil)
  return @client.get__ecommerce__price_lists(id, options)
end

#get_price_lists(options = nil) ⇒ Object

Price lists ###



210
211
212
# File 'lib/user.rb', line 210

def get_price_lists(options = nil)
  return @client.get__ecommerce__price_lists(options)
end

#get_prices(options = nil) ⇒ Object

Prices ###



193
194
195
# File 'lib/user.rb', line 193

def get_prices(options = nil)
  return @client.get__ecommerce__prices(options)
end

#get_prodict_brand(id, options = nil) ⇒ Object



231
232
233
# File 'lib/user.rb', line 231

def get_prodict_brand(id, options = nil)
  return @client.get__ecommerce__product_brands(id, options)
end

#get_prodict_template(id, options = nil) ⇒ Object



265
266
267
# File 'lib/user.rb', line 265

def get_prodict_template(id, options = nil)
  return @client.get__ecommerce__product_templates(id, options)
end

#get_prodict_type(id, options = nil) ⇒ Object



248
249
250
# File 'lib/user.rb', line 248

def get_prodict_type(id, options = nil)
  return @client.get__ecommerce__product_types(id, options)
end

#get_product(id, options = nil) ⇒ Object



163
164
165
# File 'lib/user.rb', line 163

def get_product(id, options = nil)
  return @client.get__ecommerce__products(id, options)
end

#get_product_brands(options = nil) ⇒ Object

Product brands ###



227
228
229
# File 'lib/user.rb', line 227

def get_product_brands(options = nil)
  return @client.get__ecommerce__product_brands(options)
end

#get_product_templates(options = nil) ⇒ Object

Product templates ###



261
262
263
# File 'lib/user.rb', line 261

def get_product_templates(options = nil)
  return @client.get__ecommerce__product_templates(options)
end

#get_product_types(options = nil) ⇒ Object

Product types ###



244
245
246
# File 'lib/user.rb', line 244

def get_product_types(options = nil)
  return @client.get__ecommerce__product_types(options)
end

#get_products(options = nil) ⇒ Object

Ecommerce ######################################### Products ###



159
160
161
# File 'lib/user.rb', line 159

def get_products(options = nil)
  return @client.get__ecommerce__products(options)
end

#get_sku(id, options = nil) ⇒ Object



180
181
182
# File 'lib/user.rb', line 180

def get_sku(id, options = nil)
  return @client.get__ecommerce__skus(id, options)
end

#get_skus(options = nil) ⇒ Object

SKUs ###



176
177
178
# File 'lib/user.rb', line 176

def get_skus(options = nil)
  return @client.get__ecommerce__skus(options)
end

#get_stories(options = nil) ⇒ Object

Content ######################################### Stories ###



73
74
75
# File 'lib/user.rb', line 73

def get_stories(options = nil)
  return @client.get__content__stories(options)
end

#get_story(id, options = nil) ⇒ Object



77
78
79
# File 'lib/user.rb', line 77

def get_story(id, options = nil)
  return @client.get__content__stories(id, options)
end

#get_story_template(id, options = nil) ⇒ Object



94
95
96
# File 'lib/user.rb', line 94

def get_story_template(id, options = nil)
  return @client.get__content__story_templates(id, options)
end

#get_story_templates(options = nil) ⇒ Object

Stories templates ###



90
91
92
# File 'lib/user.rb', line 90

def get_story_templates(options = nil)
  return @client.get__content__story_templates(options)
end

#login(email, password) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
# File 'lib/user.rb', line 9

def (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

#update_company(id, data, options = nil) ⇒ Object



50
51
52
# File 'lib/user.rb', line 50

def update_company(id, data, options = nil)
  return @client.update__crm__companies(id, data, options)
end

#update_contact(id, data, options = nil) ⇒ Object



34
35
36
# File 'lib/user.rb', line 34

def update_contact(id, data, options = nil)
  return @client.update__crm__contacts(id, data, options)
end

#update_content_instance(id, data, options = nil) ⇒ Object



119
120
121
# File 'lib/user.rb', line 119

def update_content_instance(id, data, options = nil)
  return @client.update__content__instances(id, data, options)
end

#update_content_page(id, data, options = nil) ⇒ Object



136
137
138
# File 'lib/user.rb', line 136

def update_content_page(id, data, options = nil)
  return @client.update__content__pages(id, data, options)
end

#update_deal(id, data, options = nil) ⇒ Object



67
68
69
# File 'lib/user.rb', line 67

def update_deal(id, data, options = nil)
  return @client.update__crm__deals(id, data, options)
end

#update_location(id, data, options = nil) ⇒ Object



291
292
293
# File 'lib/user.rb', line 291

def update_location(id, data, options = nil)
  return @client.update__ecommerce__locations(id, data, options)
end

#update_price(id, data, options = nil) ⇒ Object



205
206
207
# File 'lib/user.rb', line 205

def update_price(id, data, options = nil)
  return @client.update__ecommerce__prices(id, data, options)
end

#update_price_list(id, data, options = nil) ⇒ Object



222
223
224
# File 'lib/user.rb', line 222

def update_price_list(id, data, options = nil)
  return @client.update__ecommerce__price_lists(id, data, options)
end

#update_product(id, data, options = nil) ⇒ Object



171
172
173
# File 'lib/user.rb', line 171

def update_product(id, data, options = nil)
  return @client.update__ecommerce__products(id, data, options)
end

#update_product_brand(id, data, options = nil) ⇒ Object



239
240
241
# File 'lib/user.rb', line 239

def update_product_brand(id, data, options = nil)
  return @client.update__ecommerce__product_brands(id, data, options)
end

#update_product_template(id, data, options = nil) ⇒ Object



273
274
275
# File 'lib/user.rb', line 273

def update_product_template(id, data, options = nil)
  return @client.update__ecommerce__product_templates(id, data, options)
end

#update_product_type(id, data, options = nil) ⇒ Object



256
257
258
# File 'lib/user.rb', line 256

def update_product_type(id, data, options = nil)
  return @client.update__ecommerce__product_types(id, data, options)
end

#update_sku(id, data, options = nil) ⇒ Object



188
189
190
# File 'lib/user.rb', line 188

def update_sku(id, data, options = nil)
  return @client.update__ecommerce__skus(id, data, options)
end

#update_story(id, data, options = nil) ⇒ Object



85
86
87
# File 'lib/user.rb', line 85

def update_story(id, data, options = nil)
  return @client.update__content__stories(id, data, options)
end

#update_story_template(id, data, options = nil) ⇒ Object



102
103
104
# File 'lib/user.rb', line 102

def update_story_template(id, data, options = nil)
  return @client.update__content__story_templates(id, data, options)
end