Class: Files::Lead

Inherits:
Object
  • Object
show all
Defined in:
lib/files.com/models/lead.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}, options = {}) ⇒ Lead

Returns a new instance of Lead.



7
8
9
10
# File 'lib/files.com/models/lead.rb', line 7

def initialize(attributes = {}, options = {})
  @attributes = attributes || {}
  @options = options || {}
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



5
6
7
# File 'lib/files.com/models/lead.rb', line 5

def attributes
  @attributes
end

#optionsObject (readonly)

Returns the value of attribute options.



5
6
7
# File 'lib/files.com/models/lead.rb', line 5

def options
  @options
end

Class Method Details

.create(params = {}, options = {}) ⇒ Object

Parameters:

recaptcha_token - string
name - string - Lead name
address - string - Lead address
address_2 - string - Lead address 2
city - string - Lead city
contact_name - string - Contact name at the company
currency - string - Lead preferred currency
email - string - Lead email address
language - string - Lead preferred language
phone_number - string - Lead phone number
state - string - Lead state
zip - string - Lead zipcode
form_name - string - Signup form name
lead_source - string - Source of the lead
opportunity_comment - string - Opportunity comment
opportunity_type - string - Type of opportunity to create
gclid - string - Google Adwords Click ID
original_brand - string - Brand: `files`, `exavault` or `mover`
utm_campaign - string - Marketing tracking - campaign
utm_content - string - Marketing tracking - content
utm_domain - string - Marketing tracking - domain
utm_medium - string - Marketing tracking - medium
utm_source - string - Marketing tracking - source
utm_term - string - Marketing tracking - term
time_zone - string - Time zone, as returned by Javascript
time_zone_offset - int64 - Time zone offset (integer from -12 to 12)


338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
# File 'lib/files.com/models/lead.rb', line 338

def self.create(params = {}, options = {})
  raise InvalidParameterError.new("Bad parameter: recaptcha_token must be an String") if params[:recaptcha_token] and !params[:recaptcha_token].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: name must be an String") if params[:name] and !params[:name].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: address must be an String") if params[:address] and !params[:address].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: address_2 must be an String") if params[:address_2] and !params[:address_2].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: city must be an String") if params[:city] and !params[:city].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: contact_name must be an String") if params[:contact_name] and !params[:contact_name].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: currency must be an String") if params[:currency] and !params[:currency].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: email must be an String") if params[:email] and !params[:email].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: language must be an String") if params[:language] and !params[:language].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: phone_number must be an String") if params[:phone_number] and !params[:phone_number].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: state must be an String") if params[:state] and !params[:state].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: zip must be an String") if params[:zip] and !params[:zip].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: form_name must be an String") if params[:form_name] and !params[:form_name].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: lead_source must be an String") if params[:lead_source] and !params[:lead_source].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: opportunity_comment must be an String") if params[:opportunity_comment] and !params[:opportunity_comment].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: opportunity_type must be an String") if params[:opportunity_type] and !params[:opportunity_type].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: gclid must be an String") if params[:gclid] and !params[:gclid].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: original_brand must be an String") if params[:original_brand] and !params[:original_brand].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: utm_campaign must be an String") if params[:utm_campaign] and !params[:utm_campaign].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: utm_content must be an String") if params[:utm_content] and !params[:utm_content].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: utm_domain must be an String") if params[:utm_domain] and !params[:utm_domain].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: utm_medium must be an String") if params[:utm_medium] and !params[:utm_medium].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: utm_source must be an String") if params[:utm_source] and !params[:utm_source].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: utm_term must be an String") if params[:utm_term] and !params[:utm_term].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: time_zone must be an String") if params[:time_zone] and !params[:time_zone].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: time_zone_offset must be an Integer") if params[:time_zone_offset] and !params[:time_zone_offset].is_a?(Integer)

  response, options = Api.send_request("/leads", :post, params, options)
  Lead.new(response.data, options)
end

.update(code, params = {}, options = {}) ⇒ Object

Parameters:

code (required) - string - Lead lookup code.
recaptcha_token - string
name - string - Lead name
address - string - Lead address
address_2 - string - Lead address 2
city - string - Lead city
contact_name - string - Contact name at the company
currency - string - Lead preferred currency
email - string - Lead email address
language - string - Lead preferred language
phone_number - string - Lead phone number
state - string - Lead state
zip - string - Lead zipcode
form_name - string - Signup form name
lead_source - string - Source of the lead
opportunity_comment - string - Opportunity comment
opportunity_type - string - Type of opportunity to create
gclid - string - Google Adwords Click ID
original_brand - string - Brand: `files`, `exavault` or `mover`
utm_campaign - string - Marketing tracking - campaign
utm_content - string - Marketing tracking - content
utm_domain - string - Marketing tracking - domain
utm_medium - string - Marketing tracking - medium
utm_source - string - Marketing tracking - source
utm_term - string - Marketing tracking - term
time_zone - string - Time zone, as returned by Javascript
time_zone_offset - int64 - Time zone offset (integer from -12 to 12)


398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
# File 'lib/files.com/models/lead.rb', line 398

def self.update(code, params = {}, options = {})
  params ||= {}
  params[:code] = code
  raise InvalidParameterError.new("Bad parameter: code must be an String") if params[:code] and !params[:code].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: recaptcha_token must be an String") if params[:recaptcha_token] and !params[:recaptcha_token].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: name must be an String") if params[:name] and !params[:name].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: address must be an String") if params[:address] and !params[:address].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: address_2 must be an String") if params[:address_2] and !params[:address_2].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: city must be an String") if params[:city] and !params[:city].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: contact_name must be an String") if params[:contact_name] and !params[:contact_name].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: currency must be an String") if params[:currency] and !params[:currency].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: email must be an String") if params[:email] and !params[:email].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: language must be an String") if params[:language] and !params[:language].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: phone_number must be an String") if params[:phone_number] and !params[:phone_number].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: state must be an String") if params[:state] and !params[:state].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: zip must be an String") if params[:zip] and !params[:zip].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: form_name must be an String") if params[:form_name] and !params[:form_name].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: lead_source must be an String") if params[:lead_source] and !params[:lead_source].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: opportunity_comment must be an String") if params[:opportunity_comment] and !params[:opportunity_comment].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: opportunity_type must be an String") if params[:opportunity_type] and !params[:opportunity_type].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: gclid must be an String") if params[:gclid] and !params[:gclid].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: original_brand must be an String") if params[:original_brand] and !params[:original_brand].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: utm_campaign must be an String") if params[:utm_campaign] and !params[:utm_campaign].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: utm_content must be an String") if params[:utm_content] and !params[:utm_content].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: utm_domain must be an String") if params[:utm_domain] and !params[:utm_domain].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: utm_medium must be an String") if params[:utm_medium] and !params[:utm_medium].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: utm_source must be an String") if params[:utm_source] and !params[:utm_source].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: utm_term must be an String") if params[:utm_term] and !params[:utm_term].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: time_zone must be an String") if params[:time_zone] and !params[:time_zone].is_a?(String)
  raise InvalidParameterError.new("Bad parameter: time_zone_offset must be an Integer") if params[:time_zone_offset] and !params[:time_zone_offset].is_a?(Integer)
  raise MissingParameterError.new("Parameter missing: code") unless params[:code]

  response, options = Api.send_request("/leads/#{params[:code]}", :patch, params, options)
  Lead.new(response.data, options)
end

Instance Method Details

#addressObject

string - Lead address



40
41
42
# File 'lib/files.com/models/lead.rb', line 40

def address
  @attributes[:address]
end

#address=(value) ⇒ Object



44
45
46
# File 'lib/files.com/models/lead.rb', line 44

def address=(value)
  @attributes[:address] = value
end

#address_2Object

string - Lead address 2



49
50
51
# File 'lib/files.com/models/lead.rb', line 49

def address_2
  @attributes[:address_2]
end

#address_2=(value) ⇒ Object



53
54
55
# File 'lib/files.com/models/lead.rb', line 53

def address_2=(value)
  @attributes[:address_2] = value
end

#cityObject

string - Lead city



58
59
60
# File 'lib/files.com/models/lead.rb', line 58

def city
  @attributes[:city]
end

#city=(value) ⇒ Object



62
63
64
# File 'lib/files.com/models/lead.rb', line 62

def city=(value)
  @attributes[:city] = value
end

#codeObject

string - Lead Cookie Code



22
23
24
# File 'lib/files.com/models/lead.rb', line 22

def code
  @attributes[:code]
end

#code=(value) ⇒ Object



26
27
28
# File 'lib/files.com/models/lead.rb', line 26

def code=(value)
  @attributes[:code] = value
end

#company_nameObject

string - Lead company name



67
68
69
# File 'lib/files.com/models/lead.rb', line 67

def company_name
  @attributes[:company_name]
end

#company_name=(value) ⇒ Object



71
72
73
# File 'lib/files.com/models/lead.rb', line 71

def company_name=(value)
  @attributes[:company_name] = value
end

#contact_nameObject

string - Contact name at the company



76
77
78
# File 'lib/files.com/models/lead.rb', line 76

def contact_name
  @attributes[:contact_name]
end

#contact_name=(value) ⇒ Object



80
81
82
# File 'lib/files.com/models/lead.rb', line 80

def contact_name=(value)
  @attributes[:contact_name] = value
end

#countryObject

string - Lead country



85
86
87
# File 'lib/files.com/models/lead.rb', line 85

def country
  @attributes[:country]
end

#country=(value) ⇒ Object



89
90
91
# File 'lib/files.com/models/lead.rb', line 89

def country=(value)
  @attributes[:country] = value
end

#currencyObject

string - Lead preferred currency



94
95
96
# File 'lib/files.com/models/lead.rb', line 94

def currency
  @attributes[:currency]
end

#currency=(value) ⇒ Object



98
99
100
# File 'lib/files.com/models/lead.rb', line 98

def currency=(value)
  @attributes[:currency] = value
end

#emailObject

string - Lead email address



103
104
105
# File 'lib/files.com/models/lead.rb', line 103

def email
  @attributes[:email]
end

#email=(value) ⇒ Object



107
108
109
# File 'lib/files.com/models/lead.rb', line 107

def email=(value)
  @attributes[:email] = value
end

#form_nameObject

string - Signup form name



175
176
177
# File 'lib/files.com/models/lead.rb', line 175

def form_name
  @attributes[:form_name]
end

#form_name=(value) ⇒ Object



179
180
181
# File 'lib/files.com/models/lead.rb', line 179

def form_name=(value)
  @attributes[:form_name] = value
end

#gclidObject

string - Google Adwords Click ID



211
212
213
# File 'lib/files.com/models/lead.rb', line 211

def gclid
  @attributes[:gclid]
end

#gclid=(value) ⇒ Object



215
216
217
# File 'lib/files.com/models/lead.rb', line 215

def gclid=(value)
  @attributes[:gclid] = value
end

#idObject

int64 - Lead ID



13
14
15
# File 'lib/files.com/models/lead.rb', line 13

def id
  @attributes[:id]
end

#id=(value) ⇒ Object



17
18
19
# File 'lib/files.com/models/lead.rb', line 17

def id=(value)
  @attributes[:id] = value
end

#languageObject

string - Lead preferred language



112
113
114
# File 'lib/files.com/models/lead.rb', line 112

def language
  @attributes[:language]
end

#language=(value) ⇒ Object



116
117
118
# File 'lib/files.com/models/lead.rb', line 116

def language=(value)
  @attributes[:language] = value
end

#lead_levelObject

string - Quality score of the lead



148
149
150
# File 'lib/files.com/models/lead.rb', line 148

def lead_level
  @attributes[:lead_level]
end

#lead_level=(value) ⇒ Object



152
153
154
# File 'lib/files.com/models/lead.rb', line 152

def lead_level=(value)
  @attributes[:lead_level] = value
end

#lead_sourceObject

string - Source of the lead



184
185
186
# File 'lib/files.com/models/lead.rb', line 184

def lead_source
  @attributes[:lead_source]
end

#lead_source=(value) ⇒ Object



188
189
190
# File 'lib/files.com/models/lead.rb', line 188

def lead_source=(value)
  @attributes[:lead_source] = value
end

#nameObject

string - Lead name



31
32
33
# File 'lib/files.com/models/lead.rb', line 31

def name
  @attributes[:name]
end

#name=(value) ⇒ Object



35
36
37
# File 'lib/files.com/models/lead.rb', line 35

def name=(value)
  @attributes[:name] = value
end

#opportunity_commentObject

string - Opportunity comment



193
194
195
# File 'lib/files.com/models/lead.rb', line 193

def opportunity_comment
  @attributes[:opportunity_comment]
end

#opportunity_comment=(value) ⇒ Object



197
198
199
# File 'lib/files.com/models/lead.rb', line 197

def opportunity_comment=(value)
  @attributes[:opportunity_comment] = value
end

#opportunity_typeObject

string - Type of opportunity to create



202
203
204
# File 'lib/files.com/models/lead.rb', line 202

def opportunity_type
  @attributes[:opportunity_type]
end

#opportunity_type=(value) ⇒ Object



206
207
208
# File 'lib/files.com/models/lead.rb', line 206

def opportunity_type=(value)
  @attributes[:opportunity_type] = value
end

#original_brandObject

string - Brand: files, exavault or mover



220
221
222
# File 'lib/files.com/models/lead.rb', line 220

def original_brand
  @attributes[:original_brand]
end

#original_brand=(value) ⇒ Object



224
225
226
# File 'lib/files.com/models/lead.rb', line 224

def original_brand=(value)
  @attributes[:original_brand] = value
end

#phone_numberObject

string - Lead phone number



121
122
123
# File 'lib/files.com/models/lead.rb', line 121

def phone_number
  @attributes[:phone_number]
end

#phone_number=(value) ⇒ Object



125
126
127
# File 'lib/files.com/models/lead.rb', line 125

def phone_number=(value)
  @attributes[:phone_number] = value
end

#recaptcha_tokenObject

string



166
167
168
# File 'lib/files.com/models/lead.rb', line 166

def recaptcha_token
  @attributes[:recaptcha_token]
end

#recaptcha_token=(value) ⇒ Object



170
171
172
# File 'lib/files.com/models/lead.rb', line 170

def recaptcha_token=(value)
  @attributes[:recaptcha_token] = value
end

#saveObject



300
301
302
303
304
305
306
307
308
309
# File 'lib/files.com/models/lead.rb', line 300

def save
  if @attributes[:id]
    raise NotImplementedError.new("The Lead object doesn't support updates.")
  else
    new_obj = Lead.create(@attributes, @options)
  end

  @attributes = new_obj.attributes
  true
end

#signup_page_split_test_groupObject

string - Signup page split test group



157
158
159
# File 'lib/files.com/models/lead.rb', line 157

def 
  @attributes[:signup_page_split_test_group]
end

#signup_page_split_test_group=(value) ⇒ Object



161
162
163
# File 'lib/files.com/models/lead.rb', line 161

def (value)
  @attributes[:signup_page_split_test_group] = value
end

#stateObject

string - Lead state



130
131
132
# File 'lib/files.com/models/lead.rb', line 130

def state
  @attributes[:state]
end

#state=(value) ⇒ Object



134
135
136
# File 'lib/files.com/models/lead.rb', line 134

def state=(value)
  @attributes[:state] = value
end

#time_zoneObject

string - Time zone, as returned by Javascript



283
284
285
# File 'lib/files.com/models/lead.rb', line 283

def time_zone
  @attributes[:time_zone]
end

#time_zone=(value) ⇒ Object



287
288
289
# File 'lib/files.com/models/lead.rb', line 287

def time_zone=(value)
  @attributes[:time_zone] = value
end

#time_zone_offsetObject

int64 - Time zone offset (integer from -12 to 12)



292
293
294
# File 'lib/files.com/models/lead.rb', line 292

def time_zone_offset
  @attributes[:time_zone_offset]
end

#time_zone_offset=(value) ⇒ Object



296
297
298
# File 'lib/files.com/models/lead.rb', line 296

def time_zone_offset=(value)
  @attributes[:time_zone_offset] = value
end

#utm_campaignObject

string - Marketing tracking - campaign



229
230
231
# File 'lib/files.com/models/lead.rb', line 229

def utm_campaign
  @attributes[:utm_campaign]
end

#utm_campaign=(value) ⇒ Object



233
234
235
# File 'lib/files.com/models/lead.rb', line 233

def utm_campaign=(value)
  @attributes[:utm_campaign] = value
end

#utm_contentObject

string - Marketing tracking - content



238
239
240
# File 'lib/files.com/models/lead.rb', line 238

def utm_content
  @attributes[:utm_content]
end

#utm_content=(value) ⇒ Object



242
243
244
# File 'lib/files.com/models/lead.rb', line 242

def utm_content=(value)
  @attributes[:utm_content] = value
end

#utm_domainObject

string - Marketing tracking - domain



247
248
249
# File 'lib/files.com/models/lead.rb', line 247

def utm_domain
  @attributes[:utm_domain]
end

#utm_domain=(value) ⇒ Object



251
252
253
# File 'lib/files.com/models/lead.rb', line 251

def utm_domain=(value)
  @attributes[:utm_domain] = value
end

#utm_mediumObject

string - Marketing tracking - medium



256
257
258
# File 'lib/files.com/models/lead.rb', line 256

def utm_medium
  @attributes[:utm_medium]
end

#utm_medium=(value) ⇒ Object



260
261
262
# File 'lib/files.com/models/lead.rb', line 260

def utm_medium=(value)
  @attributes[:utm_medium] = value
end

#utm_sourceObject

string - Marketing tracking - source



265
266
267
# File 'lib/files.com/models/lead.rb', line 265

def utm_source
  @attributes[:utm_source]
end

#utm_source=(value) ⇒ Object



269
270
271
# File 'lib/files.com/models/lead.rb', line 269

def utm_source=(value)
  @attributes[:utm_source] = value
end

#utm_termObject

string - Marketing tracking - term



274
275
276
# File 'lib/files.com/models/lead.rb', line 274

def utm_term
  @attributes[:utm_term]
end

#utm_term=(value) ⇒ Object



278
279
280
# File 'lib/files.com/models/lead.rb', line 278

def utm_term=(value)
  @attributes[:utm_term] = value
end

#zipObject

string - Lead zipcode



139
140
141
# File 'lib/files.com/models/lead.rb', line 139

def zip
  @attributes[:zip]
end

#zip=(value) ⇒ Object



143
144
145
# File 'lib/files.com/models/lead.rb', line 143

def zip=(value)
  @attributes[:zip] = value
end