Class: Vng::Lead
Overview
Provides methods to interact with Vonigo leads.
Constant Summary collapse
- PATH =
'/api/v1/data/Leads/'
Instance Attribute Summary collapse
-
#email ⇒ Object
readonly
Returns the value of attribute email.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#phone ⇒ Object
readonly
Returns the value of attribute phone.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(id:, name:, email:, phone:) ⇒ Lead
constructor
A new instance of Lead.
Constructor Details
#initialize(id:, name:, email:, phone:) ⇒ Lead
Returns a new instance of Lead.
10 11 12 13 14 15 |
# File 'lib/vng/lead.rb', line 10 def initialize(id:, name:, email:, phone:) @id = id @name = name @email = email @phone = phone end |
Instance Attribute Details
#email ⇒ Object (readonly)
Returns the value of attribute email.
8 9 10 |
# File 'lib/vng/lead.rb', line 8 def email @email end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
8 9 10 |
# File 'lib/vng/lead.rb', line 8 def id @id end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
8 9 10 |
# File 'lib/vng/lead.rb', line 8 def name @name end |
#phone ⇒ Object (readonly)
Returns the value of attribute phone.
8 9 10 |
# File 'lib/vng/lead.rb', line 8 def phone @phone end |
Class Method Details
.create(name:, email:, phone:) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/vng/lead.rb', line 17 def self.create(name:, email:, phone:) body = { method: '3', Fields: [ { fieldID: 121, optionID: '59' }, { fieldID: 126, fieldValue: name }, { fieldID: 238, fieldValue: URI.encode_uri_component(email) }, { fieldID: 1024, fieldValue: phone }, ] } data = request path: PATH, body: body id = data['Client']['objectID'] name = value_for_field data, 127 email = value_for_field data, 238 phone = value_for_field data, 1024 new id: id, name: name, email: email, phone: phone end |