vng 2.4.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: eaf5c18372847d998d4e0d4c25e7bfe79ce17a11df1e573c66771cd963b3cb0a
4
- data.tar.gz: 3cb76db925bd75bc8568607e3375ee18c6ed41f1c689b0624e2fc6de642e4be2
3
+ metadata.gz: 3ce0b4bfa1bc71ea60e74d3ded65c3a610a5a9bd02d867fab27d0e59c7272a24
4
+ data.tar.gz: 85345a62558558d22899adcdf1f052d42ef19b61d160dc0d49a87604f1292695
5
5
  SHA512:
6
- metadata.gz: 527b1ced6a89489422f020b7745b6b38026d8b8187c9f3fd36abd9b55fffc21f9247a7af492c957419fe48bef126a0a3bc2894304fc23ebdb77e950446de9109
7
- data.tar.gz: 86024f32fa8d9c432225d7b0a655336e5894e0ebfc13c11b4f39f18ce5cb9df2836ca06cb056135a86f7e52253f096cc2a0607a305d38241e4992799d87e6a00
6
+ metadata.gz: a1d3770ed3fe0ef347ec57deb447af38ac3b93885fee6f20e557a61c7ea788001dd1d01485b4c95b9232ca7ae3e74397aaf382b77a21fb05304a33c20c6dd34a
7
+ data.tar.gz: 53d11a0458c95f71a557531821141ec120b58dafe266952a06149fac84e348c0cd1e0a80d86298dfb242a20bfeb69010f8fad53f9e026fc7cb6418c123bd7666
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ ## [3.0.0] - 2024-12-26
2
+
3
+ - Add Contact.edited_since(timestamp)
4
+
5
+ **Breaking changes**
6
+
7
+ - Remove Contact.all
8
+
1
9
  ## [2.4.0] - 2025-01-09
2
10
 
3
11
  - Add Contact.all
data/lib/vng/contact.rb CHANGED
@@ -5,19 +5,20 @@ module Vng
5
5
  class Contact < Resource
6
6
  PATH = '/api/v1/data/Contacts/'
7
7
 
8
- attr_reader :id, :first_name, :last_name, :email, :phone, :client_id
8
+ attr_reader :id, :first_name, :last_name, :email, :phone, :client_id, :edited_at
9
9
 
10
- def initialize(id:, first_name:, last_name:, email:, phone:, client_id:)
10
+ def initialize(id:, first_name:, last_name:, email:, phone:, client_id:, edited_at: nil)
11
11
  @id = id
12
12
  @first_name = first_name
13
13
  @last_name = last_name
14
14
  @email = email
15
15
  @phone = phone
16
16
  @client_id = client_id
17
+ @edited_at = edited_at
17
18
  end
18
19
 
19
- def self.all # TODO: add (edited_after: param)
20
- body = { isCompleteObject: 'true' }
20
+ def self.edited_since(timestamp)
21
+ body = { isCompleteObject: 'true', dateStart: timestamp.to_i, dateMode: 2 }
21
22
 
22
23
  data = request path: PATH, body: body, returning: 'Contacts'
23
24
 
@@ -30,8 +31,9 @@ module Vng
30
31
  email = value_for_field body, 97
31
32
  phone = value_for_field body, 96
32
33
  client_id = value_for_relation body, 'client'
34
+ edited_at = Time.at Integer(body['dateLastEdited']), in: 'UTC'
33
35
 
34
- new id: id, first_name: first_name, last_name: last_name, email: email, phone: phone, client_id: client_id
36
+ new id: id, first_name: first_name, last_name: last_name, email: email, phone: phone, client_id: client_id, edited_at: edited_at
35
37
  end
36
38
  end
37
39
 
@@ -123,7 +123,7 @@ module Vng
123
123
  when '/api/v1/data/Contacts/'
124
124
  if @body[:pageNo].eql? 1
125
125
  {"Contacts" => [
126
- {"objectID" => "2201007", "isActive" => "true", "Fields" => [
126
+ {"objectID" => "2201007", "dateLastEdited" => "1736479080", "isActive" => "true", "Fields" => [
127
127
  {"fieldID"=>127, "fieldValue"=>"Vng" },
128
128
  {"fieldID"=>128, "fieldValue"=>"Example" },
129
129
  {"fieldID"=>97, "fieldValue"=>"vng@example.com" },
data/lib/vng/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Vng
2
- VERSION = '2.4.0'
2
+ VERSION = '3.0.0'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vng
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.4.0
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - claudiob