dashx 0.9.0 → 0.11.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: 11a67477c71b00973b7d13e3f563f6ddac3766579512a8fbeabb2775f55058f8
4
- data.tar.gz: ad0f0e894f3676a02c65e1992920424173d55f66b451c4c72be9ac374b3f6f37
3
+ metadata.gz: 68d01067f8e6bcf4cbf6b2ebb027fc201573613cf66821d22333e09a6ddab927
4
+ data.tar.gz: a7aa4571241ef2088aa573605591d886237628d72651a642ad5ea56665f7b183
5
5
  SHA512:
6
- metadata.gz: fdebb7511f3e2e86faea3ecb9b2d8db0af9431e20164bac6d1507fe1aaa9d9bbd3f14d3afc55af8d3ae2f1799a7c60db4f0dd12fec54e200f50e7b4d052ff660
7
- data.tar.gz: 5613f37715bbaf48c957df613cdb16b42946dec65e18e3f68f9d53c6e3b7fa7afd0c66ff0403e20962b2cd31859c01b475e9e8d24e8ea8182981a533d6bbfab4
6
+ metadata.gz: 306ed0b1c42c6e49db53088032f2abbcc0134b81d6e0ee24ebf983b45a6fcbe064ccd7b98c278a6e0d27992c35ee161138bd9fa77743de33f61a68571d6bd607
7
+ data.tar.gz: a118534993a2115ac51e2565a3357299c6968fa14eff954100cb5078bab3585dc870ddd62cdfed2104b7af58e29ff2027edd173a84f63df4d8f6d799124f3c5a
data/lib/dashx/client.rb CHANGED
@@ -62,6 +62,25 @@ module DashX
62
62
  }
63
63
  '
64
64
 
65
+ FETCH_CONTACTS_REQUEST = 'query FetchContacts($input: FetchContactsInput!) {
66
+ fetchContacts(input: $input) {
67
+ contacts {
68
+ id
69
+ accountId
70
+ name
71
+ kind
72
+ value
73
+ unverifiedValue
74
+ verifiedAt
75
+ status
76
+ tag
77
+ createdAt
78
+ updatedAt
79
+ }
80
+ }
81
+ }
82
+ '
83
+
65
84
  FETCH_STORED_PREFERENCES = 'query FetchStoredPreferences($input: FetchStoredPreferencesInput) {
66
85
  fetchStoredPreferences(input: $input) {
67
86
  preferenceData
@@ -84,16 +103,9 @@ module DashX
84
103
  headers = {
85
104
  'X-Public-Key' => config.public_key,
86
105
  'X-Private-Key' => config.private_key,
106
+ 'X-Target-Environment' => config.target_environment,
87
107
  }
88
108
 
89
- if !config.target_environment.nil?
90
- headers['X-Target-Environment'] = config.target_environment
91
- end
92
-
93
- if !config.target_installation.nil?
94
- headers['X-Target-Installation'] = config.target_installation
95
- end
96
-
97
109
  self.class.headers(headers)
98
110
  end
99
111
 
@@ -144,6 +156,10 @@ module DashX
144
156
  make_graphql_request(SAVE_CONTACTS_REQUEST, { uid: uid, contacts: contacts })
145
157
  end
146
158
 
159
+ def fetch_contacts(uid)
160
+ make_graphql_request(FETCH_CONTACTS_REQUEST, { uid: uid })
161
+ end
162
+
147
163
  def fetch_item(identifier)
148
164
  make_graphql_request(FETCH_ITEM_REQUEST, { identifier: identifier })
149
165
  end
data/lib/dashx/config.rb CHANGED
@@ -1,9 +1,16 @@
1
1
  module DashX
2
+ class ConfigurationError < StandardError; end
3
+
2
4
  class Config
3
5
  attr_accessor :base_uri
4
6
  attr_accessor :public_key
5
7
  attr_accessor :private_key
6
- attr_accessor :target_installation
7
8
  attr_accessor :target_environment
9
+
10
+ def validate!
11
+ raise ConfigurationError, 'public_key must be set' if public_key.nil? || public_key.empty?
12
+ raise ConfigurationError, 'private_key must be set' if private_key.nil? || private_key.empty?
13
+ raise ConfigurationError, 'target_environment must be set' if target_environment.nil? || target_environment.empty?
14
+ end
8
15
  end
9
16
  end
data/lib/dashx/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module DashX
2
- VERSION = '0.9.0'.freeze
2
+ VERSION = '0.11.0'.freeze
3
3
  end
data/lib/dashx.rb CHANGED
@@ -8,6 +8,8 @@ module DashX
8
8
  def self.configure(client_name = :default)
9
9
  yield config = DashX::Config.new
10
10
 
11
+ config.validate!
12
+
11
13
  @clients[client_name] = DashX::Client.new(config)
12
14
  end
13
15
 
@@ -27,6 +29,10 @@ module DashX
27
29
  @clients[:default].save_contacts(uid, contacts)
28
30
  end
29
31
 
32
+ def self.fetch_contacts(uid)
33
+ @clients[:default].fetch_contacts(uid)
34
+ end
35
+
30
36
  def self.fetch_item(identifier)
31
37
  @clients[:default].fetch_item(identifier)
32
38
  end
metadata CHANGED
@@ -1,14 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dashx
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - DashX
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2023-11-15 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
12
11
  dependencies:
13
12
  - !ruby/object:Gem::Dependency
14
13
  name: httparty
@@ -24,8 +23,6 @@ dependencies:
24
23
  - - "~>"
25
24
  - !ruby/object:Gem::Version
26
25
  version: '0.16'
27
- description:
28
- email:
29
26
  executables: []
30
27
  extensions: []
31
28
  extra_rdoc_files: []
@@ -51,7 +48,6 @@ licenses:
51
48
  metadata:
52
49
  homepage_uri: https://github.com/dashxhq/dashx-ruby#readme
53
50
  source_code_uri: https://github.com/dashxhq/dashx-ruby
54
- post_install_message:
55
51
  rdoc_options: []
56
52
  require_paths:
57
53
  - lib
@@ -66,8 +62,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
66
62
  - !ruby/object:Gem::Version
67
63
  version: '0'
68
64
  requirements: []
69
- rubygems_version: 3.4.1
70
- signing_key:
65
+ rubygems_version: 3.6.7
71
66
  specification_version: 4
72
67
  summary: DashX SDK for Ruby.
73
68
  test_files: []