Class: Vng::Client

Inherits:
Resource show all
Defined in:
lib/vng/client.rb

Overview

Provides methods to interact with Vonigo clients.

Constant Summary collapse

PATH =
'/api/v1/data/Clients/'

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id:, email:) ⇒ Client



10
11
12
13
# File 'lib/vng/client.rb', line 10

def initialize(id:, email:)
  @id = id
  @email = email
end

Instance Attribute Details

#emailObject (readonly)

Returns the value of attribute email.



8
9
10
# File 'lib/vng/client.rb', line 8

def email
  @email
end

#idObject (readonly)

Returns the value of attribute id.



8
9
10
# File 'lib/vng/client.rb', line 8

def id
  @id
end

Class Method Details

.find(contact_id) ⇒ Object



16
17
18
19
20
21
22
23
24
25
26
# File 'lib/vng/client.rb', line 16

def self.find(contact_id)
  body = {
    method: '1',
    objectID: contact_id,
  }

  data = request path: PATH, body: body

  email = value_for_field data, 238
  new id: contact_id, email: email
end