vng 3.0.1 → 3.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 15e3e4b9f188fa73d3cdea696d1fac21c02ce00f1f67ada372fd328e0b1f1fac
4
- data.tar.gz: 5d12461918e68ef048dc8ac0b7111d8a1337000c1815d2273fbe15409b0fd732
3
+ metadata.gz: b010ddfb951a8a49807d40e1eae41355cfac53f9eb4774143e3b86ffbc4b892b
4
+ data.tar.gz: c495b73abd2a24b93f7fe0556a1ede1a48adeb9e08b19809099d9c95134c9fb6
5
5
  SHA512:
6
- metadata.gz: 3610cb024f1fcfaddd1d26fcfa82052bd43431a1890d2bed429c9eb0c8e1a7622a4be507bd57cec0c14c0cb08c03eda72f0d45a4acf97884b13c8b57004ed7f6
7
- data.tar.gz: a0c5144d0e2458ec4830814d0689cf24a8cc3ce00915ba2c6649795fc3a45e6c5325c2f8a52ab650af03b522d73a92e1aca2efe93ffb11ded2b80855216704df
6
+ metadata.gz: 50527cbbbbb3e550b54052dd9ff42e511d24fcf6904687ad46b1a7f931882a4064fed2db14243ca4f8d5c890147f806c7f2a7dbb33ff0708848b7e09448bc79b
7
+ data.tar.gz: 7611cfffca87c56f59a39e526386ebd1c224d65c6d8be53d86518f0f5dc2a616c3d80e6d4242032939a5bc6380dd259bb95a133fec775bb67f3288b4d51ff328
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## [3.2.0] - 2025-01-15
2
+
3
+ - Add Lead#notes
4
+
5
+ ## [3.1.0] - 2025-01-11
6
+
7
+ - Add Client.find(id)
8
+
1
9
  ## [3.0.1] - 2025-01-10
2
10
 
3
11
  - Make Contact.edited_since lazy
data/lib/vng/client.rb ADDED
@@ -0,0 +1,28 @@
1
+ require 'vng/availability'
2
+
3
+ module Vng
4
+ # Provides methods to interact with Vonigo clients.
5
+ class Client < Resource
6
+ PATH = '/api/v1/data/Clients/'
7
+
8
+ attr_reader :id, :email
9
+
10
+ def initialize(id:, email:)
11
+ @id = id
12
+ @email = email
13
+ end
14
+
15
+
16
+ def self.find(contact_id)
17
+ body = {
18
+ method: '1',
19
+ objectID: contact_id,
20
+ }
21
+
22
+ data = request path: PATH, body: body
23
+
24
+ email = value_for_field data, 238
25
+ new id: contact_id, email: email
26
+ end
27
+ end
28
+ end
data/lib/vng/lead.rb CHANGED
@@ -5,16 +5,17 @@ module Vng
5
5
  class Lead < Resource
6
6
  PATH = '/api/v1/data/Leads/'
7
7
 
8
- attr_reader :id, :name, :email, :phone
8
+ attr_reader :id, :name, :email, :phone, :notes
9
9
 
10
- def initialize(id:, name:, email:, phone:)
10
+ def initialize(id:, name:, email:, phone:, notes:)
11
11
  @id = id
12
12
  @name = name
13
13
  @email = email
14
14
  @phone = phone
15
+ @notes = notes
15
16
  end
16
17
 
17
- def self.create(name:, email:, phone:)
18
+ def self.create(name:, email:, phone:, notes: nil)
18
19
  body = {
19
20
  method: '3',
20
21
  Fields: [
@@ -25,14 +26,17 @@ module Vng
25
26
  ]
26
27
  }
27
28
 
29
+ body[:Fields] << { fieldID: 108, fieldValue: notes } if notes
30
+
28
31
  data = request path: PATH, body: body
29
32
 
30
33
  id = data['Client']['objectID']
31
34
  name = value_for_field data, 127
32
35
  email = value_for_field data, 238
33
36
  phone = value_for_field data, 1024
37
+ notes = value_for_field data, 108
34
38
 
35
- new id: id, name: name, email: email, phone: phone
39
+ new id: id, name: name, email: email, phone: phone, notes: notes
36
40
  end
37
41
  end
38
42
  end
@@ -118,6 +118,7 @@ module Vng
118
118
  { "fieldID"=>126, "fieldValue"=>"Vng Example" },
119
119
  { "fieldID"=>238, "fieldValue"=>"vng@example.com" },
120
120
  { "fieldID"=>1024, "fieldValue"=>"8648648640" },
121
+ { "fieldID"=>108, "fieldValue"=>"Lead notes" },
121
122
  ] }
122
123
  end
123
124
  when '/api/v1/data/Contacts/'
@@ -130,7 +131,14 @@ module Vng
130
131
  {"fieldID"=>96, "fieldValue"=>"8648648640" },
131
132
  ], "Relations" => [
132
133
  {"objectID" => 915738, "relationType" => "client", "isActive" => "true"},
133
- ]}
134
+ ]},
135
+ {"objectID" => "2201008", "dateLastEdited" => "1736479081", "isActive" => "true", "Fields" => [
136
+ {"fieldID"=>127, "fieldValue"=>"No" },
137
+ {"fieldID"=>128, "fieldValue"=>"Email" },
138
+ {"fieldID"=>96, "fieldValue"=>"8648648640" },
139
+ ], "Relations" => [
140
+ {"objectID" => 916758, "relationType" => "client", "isActive" => "true"},
141
+ ]},
134
142
  ]}
135
143
  elsif @body[:pageNo].nil?
136
144
  { "Contact"=>{ "objectID"=>"2201007" }, "Fields"=> [
@@ -144,6 +152,10 @@ module Vng
144
152
  end
145
153
  when '/api/v1/data/Locations/'
146
154
  { "Location"=>{ "objectID"=>995681 } }
155
+ when '/api/v1/data/Clients/'
156
+ { "Client" => { "objectID" => "916758" }, "Fields" => [
157
+ { "fieldID" => 238, "fieldValue" => "vng@example.com", "optionID" => 0 }
158
+ ] }
147
159
  when '/api/v1/data/Assets/'
148
160
  if @body[:method].eql? '3'
149
161
  if @body[:Fields].find{|field| field[:fieldID] == 1014}[:optionID].eql? 304
data/lib/vng/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Vng
2
- VERSION = '3.0.1'
2
+ VERSION = '3.2.0'
3
3
  end
data/lib/vng.rb CHANGED
@@ -10,6 +10,7 @@ require_relative 'vng/availability'
10
10
  require_relative 'vng/breed'
11
11
  require_relative 'vng/case'
12
12
  require_relative 'vng/connection_error'
13
+ require_relative 'vng/client'
13
14
  require_relative 'vng/contact'
14
15
  require_relative 'vng/franchise'
15
16
  require_relative 'vng/lead'
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vng
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.1
4
+ version: 3.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - claudiob
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2025-01-11 00:00:00.000000000 Z
10
+ date: 2025-01-15 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: simplecov
@@ -69,6 +69,7 @@ files:
69
69
  - lib/vng/availability.rb
70
70
  - lib/vng/breed.rb
71
71
  - lib/vng/case.rb
72
+ - lib/vng/client.rb
72
73
  - lib/vng/config.rb
73
74
  - lib/vng/configuration.rb
74
75
  - lib/vng/connection_error.rb