Method: Vng::Contact.create

Defined in:
lib/vng/contact.rb

.create(first_name:, last_name:, email:, phone:, client_id:) ⇒ Object



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/vng/contact.rb', line 65

def self.create(first_name:, last_name:, email:, phone:, client_id:)
  body = {
    method: '3',
    clientID: client_id,
    Fields: [
       { fieldID: 127, fieldValue: first_name },
       { fieldID: 128, fieldValue: last_name },
       { fieldID: 97, fieldValue: URI.encode_uri_component(email) },
       { fieldID: 96, fieldValue: phone },
    ]
  }

  data = request path: PATH, body: body
  new data['Contact']
end