dashx 0.4.0 → 0.6.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: 3e9578ce1862a92700ae78645655193f4bdf0e66bd12f615c8c46ad5c7e530cd
4
- data.tar.gz: 39519a687bc85f41dd3c5420f362563e05a2fe913d9a91864b6782abf7357484
3
+ metadata.gz: bd9b7271b84d78a258be2f0e8b08dbcc1325f027a7bb13b74bb96e5260c41a19
4
+ data.tar.gz: 747049c3eb438b0d1f15694f82d502ecb3fa0b87e431a1ddb54f6a0d24616edc
5
5
  SHA512:
6
- metadata.gz: 05bc8f1fef51ef174a7e6b49138423deadbfa5fe7847cae1587758f63808e583556cf19422dbaaebb1bb07ba0192cf98ff692b3d3c2a86846c19a1915e318448
7
- data.tar.gz: 997c2ff5c8193c9f423f97c669820573e1c6e0469ee398e69c77386064f89303afef0167309f77228671e9406480c76bec04bcadb6b0cc66a0a53bf243993c60
6
+ metadata.gz: a71ee302b07ec805e255ce59d1232491e47c1fdfa083f46186360afb6a6e91d4b2e75ab655df535ccfd52dad44a563cd09c436a399a5cd16233d2e079540859e
7
+ data.tar.gz: bb8185ff64391239a49bc405b4e94c6249d1e1a4174c2b52df0294ce5be167a6dc989c98a9e5e9d75a8738ba49750ab3b8c6564d6ce636d424952496c8b16e6c
data/README.md CHANGED
@@ -1,93 +1,56 @@
1
- # DashX
1
+ <p align="center">
2
+ <br />
3
+ <a href="https://dashx.com"><img src="https://raw.githubusercontent.com/dashxhq/brand-book/master/assets/logo-black-text-color-icon@2x.png" alt="DashX" height="40" /></a>
4
+ <br />
5
+ <br />
6
+ <strong>Your All-in-One Product Stack</strong>
7
+ </p>
2
8
 
3
- DashX SDK for Ruby
9
+ <div align="center">
10
+ <h4>
11
+ <a href="https://dashx.com">Website</a>
12
+ <span> | </span>
13
+ <a href="https://dashxdemo.com">Demos</a>
14
+ <span> | </span>
15
+ <a href="https://docs.dashx.com/developer">Documentation</a>
16
+ </h4>
17
+ </div>
4
18
 
5
- ## Installation
19
+ <br />
6
20
 
7
- Add this line to your application's Gemfile:
8
-
9
- ```ruby
10
- gem 'dashx'
11
- ```
12
-
13
- And then execute:
14
-
15
- $ bundle install
16
-
17
- Or install it yourself as:
21
+ # dashx-ruby
18
22
 
19
- $ gem install dashx
23
+ _DashX SDK for Ruby_
20
24
 
21
- ## Usage
22
-
23
- ```ruby
24
- require 'dashx'
25
-
26
- DashX.deliver({ to: 'johndoe@example.com' })
27
- ```
25
+ ## Install
28
26
 
29
- ### Configuration
30
-
31
- ```ruby
32
- DashX.configure do |config|
33
- config.public_key = ENV['DASHX_PUBLIC_KEY']
34
- config.private_key = ENV['DASHX_PRIVATE_KEY']
35
- end
36
- ```
37
-
38
- ### Deliver
27
+ Add this line to your application's Gemfile:
39
28
 
40
29
  ```ruby
41
- DashX.deliver({
42
- to: 'John Doe <john@example.com>',
43
- body: 'Hello World!'
44
- });
30
+ gem 'dashx'
45
31
  ```
46
32
 
47
- `deliver` can accept multiple recipients like so:
33
+ And then execute:
48
34
 
49
- ```ruby
50
- DashX.deliver({
51
- to: ['John Doe <john@example.com>','admin@example.com', 'sales@example.com>'],
52
- body: 'Hello World!'
53
- });
35
+ ```sh
36
+ bundle install
54
37
  ```
55
38
 
56
- ### Identify
57
-
58
- You can use `identify` to update user info associated with the provided `uid`
39
+ Or install it yourself as:
59
40
 
60
- ```ruby
61
- DashX.identify('uid_of_user', {
62
- first_name: 'John',
63
- last_name: 'Doe',
64
- email: 'johndoe@email.com',
65
- phone: '+1-234-567-8910'
66
- })
41
+ ```sh
42
+ gem install dashx
67
43
  ```
68
44
 
69
- ##### For Anonymous User
70
-
71
- When you don't know the `uid` of a user, you can still use `identify` to add user info like so:
72
-
73
- ```ruby
74
- DashX.identify({
75
- first_name: 'John',
76
- last_name: 'Doe',
77
- email: 'johndoe@email.com',
78
- phone: '+1-234-567-8910'
79
- })
80
- ```
45
+ ## Usage
81
46
 
82
- `identify` will automatically append a pseudo-random `anonymous_uid` in this case.
47
+ For detailed usage, refer to the [documentation](https://docs.dashx.com/developer).
83
48
 
84
- ### Track
49
+ ## Contributing
85
50
 
86
- ```ruby
87
- DashX.track('event_name', 'uid_of_user', { hello: 'world' })
88
- ```
51
+ Bug reports and pull requests are welcome on GitHub at https://github.com/dashxhq/dashx-ruby. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/dashxhq/dashx-ruby/blob/master/CODE_OF_CONDUCT.md).
89
52
 
90
- ## Development
53
+ ### Development
91
54
 
92
55
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests.
93
56
 
@@ -95,7 +58,7 @@ You can also run `bin/console` for an interactive prompt that will allow you to
95
58
 
96
59
  To install this gem onto your local machine, run `bundle exec rake install`.
97
60
 
98
- # Publishing
61
+ ### Publishing
99
62
 
100
63
  We use the amazing [gem-release](https://github.com/svenfuchs/gem-release) for releases.
101
64
 
@@ -114,10 +77,6 @@ git push origin master // Push the version bump commit
114
77
  gem release
115
78
  ```
116
79
 
117
- ## Contributing
118
-
119
- Bug reports and pull requests are welcome on GitHub at https://github.com/dashxhq/dashx-ruby. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/dashxhq/dashx-ruby/blob/master/CODE_OF_CONDUCT.md).
120
-
121
80
  ## License
122
81
 
123
82
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/lib/dashx/client.rb CHANGED
@@ -35,6 +35,47 @@ module DashX
35
35
  }
36
36
  '
37
37
 
38
+ FETCH_ITEM_REQUEST = 'query FetchItem($input: FetchItemInput) {
39
+ fetchItem(input: $input) {
40
+ id
41
+ installationId
42
+ name
43
+ identifier
44
+ description
45
+ createdAt
46
+ updatedAt
47
+ pricings {
48
+ id
49
+ kind
50
+ amount
51
+ originalAmount
52
+ isRecurring
53
+ recurringInterval
54
+ recurringIntervalUnit
55
+ appleProductIdentifier
56
+ googleProductIdentifier
57
+ currencyCode
58
+ createdAt
59
+ updatedAt
60
+ }
61
+ }
62
+ }
63
+ '
64
+
65
+ FETCH_STORED_PREFERENCES = 'query FetchStoredPreferences($input: FetchStoredPreferencesInput) {
66
+ fetchStoredPreferences(input: $input) {
67
+ preferenceData
68
+ }
69
+ }
70
+ '
71
+
72
+ SAVE_STORED_PREFERENCES = 'query SaveStoredPreferences($input: SaveStoredPreferencesInput) {
73
+ saveStoredPreferences(input: $input) {
74
+ success
75
+ }
76
+ }
77
+ '
78
+
38
79
  def initialize(config)
39
80
  @config = config
40
81
 
@@ -95,28 +136,24 @@ module DashX
95
136
  def track(event, uid, data = nil)
96
137
  symbolize_keys! data unless data.nil?
97
138
 
98
- make_graphql_request(TRACK_EVENT_REQUEST, { event: event, uid: uid, data: data })
139
+ make_graphql_request(TRACK_EVENT_REQUEST, { event: event, accountUid: uid, data: data })
99
140
  end
100
141
 
101
- def generate_identity_token(uid, options = {})
102
- check_presence!(uid, 'uid')
103
- symbolize_keys! options
142
+ def save_contacts(uid, contacts = [])
143
+ contacts.each(&:symbolize_keys!)
144
+ make_graphql_request(SAVE_CONTACTS_REQUEST, { uid: uid, contacts: contacts })
145
+ end
104
146
 
105
- kind = options[:kind] || 'regular'
106
- plain_text = "v1;#{kind};#{uid}"
147
+ def fetch_item(identifier)
148
+ make_graphql_request(FETCH_ITEM_REQUEST, { identifier: identifier })
149
+ end
107
150
 
108
- cipher = OpenSSL::Cipher::AES.new(256, :GCM).encrypt
109
- cipher.key = @config.private_key
110
- nonce = cipher.random_iv
111
- cipher.iv = nonce
112
- encrypted = cipher.update(plain_text) + cipher.final
113
- encrypted_token = "#{nonce}#{encrypted}#{cipher.auth_tag}"
114
- Base64.urlsafe_encode64(encrypted_token)
151
+ def fetch_stored_preferences(uid)
152
+ make_graphql_request(FETCH_STORED_PREFERENCES, { accountUid: uid })
115
153
  end
116
154
 
117
- def save_contacts(uid, contacts = [])
118
- contacts.each(&:symbolize_keys!)
119
- make_graphql_request(SAVE_CONTACTS_REQUEST, { uid: uid, contacts: contacts })
155
+ def save_stored_preferences(uid, preferenceData)
156
+ make_graphql_request(SAVE_STORED_PREFERENCES, { accountUid: uid, preferenceData: preferenceData })
120
157
  end
121
158
 
122
159
  private
data/lib/dashx/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module DashX
2
- VERSION = '0.4.0'.freeze
2
+ VERSION = '0.6.0'.freeze
3
3
  end
data/lib/dashx.rb CHANGED
@@ -23,11 +23,19 @@ module DashX
23
23
  @clients[:default].track(event, uid, data)
24
24
  end
25
25
 
26
- def self.generate_identity_token(uid)
27
- @clients[:default].generate_identity_token(uid)
28
- end
29
-
30
26
  def self.save_contacts(uid, contacts)
31
27
  @clients[:default].save_contacts(uid, contacts)
32
28
  end
29
+
30
+ def self.fetch_item(identifier)
31
+ @clients[:default].fetch_item(identifier)
32
+ end
33
+
34
+ def self.fetch_stored_preferences(uid)
35
+ @clients[:default].fetch_stored_preferences(uid)
36
+ end
37
+
38
+ def self.save_stored_preferences(uid, preferenceData)
39
+ @clients[:default].save_stored_preferences(uid, preferenceData)
40
+ end
33
41
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dashx
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - DashX
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-06-22 00:00:00.000000000 Z
11
+ date: 2023-10-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -24,8 +24,8 @@ dependencies:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0.16'
27
- description:
28
- email:
27
+ description:
28
+ email:
29
29
  executables: []
30
30
  extensions: []
31
31
  extra_rdoc_files: []
@@ -51,7 +51,7 @@ licenses:
51
51
  metadata:
52
52
  homepage_uri: https://github.com/dashxhq/dashx-ruby#readme
53
53
  source_code_uri: https://github.com/dashxhq/dashx-ruby
54
- post_install_message:
54
+ post_install_message:
55
55
  rdoc_options: []
56
56
  require_paths:
57
57
  - lib
@@ -66,8 +66,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
66
66
  - !ruby/object:Gem::Version
67
67
  version: '0'
68
68
  requirements: []
69
- rubygems_version: 3.3.3
70
- signing_key:
69
+ rubygems_version: 3.1.2
70
+ signing_key:
71
71
  specification_version: 4
72
72
  summary: DashX SDK for Ruby.
73
73
  test_files: []