dashx 0.3.0 → 0.5.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: 06ad40758bc5f6cd2a2112d112e5d5f89116236223d49d4f587e4e5b3e1fec29
4
- data.tar.gz: 1e69514d594c29381d72bb39fa88601b19c8172344fee5cd09f23f815d2d9fec
3
+ metadata.gz: b0aada5ee24fcb39cdf0963c82aaa861a07f4837f4147b0ed2b96349a19b88f5
4
+ data.tar.gz: '08e1160582de21e8c92165b5102bea7a358b1078cddff04dc0340d016a849aa7'
5
5
  SHA512:
6
- metadata.gz: d8259173a1f98ea91ebd618ce630c7852bc5e95d2088e250a52867aa24dbdc4a20267c30566d4c972c525bd455737010d3a7fae8accb93bc188f98eebd2d1893
7
- data.tar.gz: 1ed90ead1e57ac5d62caebe5717469af66e01dc44b6ccc083511d102919cfd94b4decf57263620c0eb97f9c94fa532b05f71cd0878f77023d3314f81e6af4a0a
6
+ metadata.gz: 922481e88e687b49ffb637459f6491f9599481370d9370c34c03a496fb35b82ea9834eabb8440b7e47ac94bd60851792a171c71732c4dcb29a320599206fe3d8
7
+ data.tar.gz: 67a9f73f7000937dfa1c6b56fc50f7f7d5225b5ebafff2376033e468b97c6fc1e055f72fbaa4e722cf1bf4bf8b213f89094495c83b9c5837bff404bc7a91bd71
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
@@ -21,7 +21,7 @@ module DashX
21
21
 
22
22
  TRACK_EVENT_REQUEST = 'mutation TrackEvent($input: TrackEventInput!) {
23
23
  trackEvent(input: $input) {
24
- id
24
+ success
25
25
  }
26
26
  }
27
27
  '
@@ -35,6 +35,33 @@ 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
+
38
65
  def initialize(config)
39
66
  @config = config
40
67
 
@@ -95,23 +122,7 @@ module DashX
95
122
  def track(event, uid, data = nil)
96
123
  symbolize_keys! data unless data.nil?
97
124
 
98
- make_graphql_request(TRACK_EVENT_REQUEST, { event: event, uid: uid, data: data })
99
- end
100
-
101
- def generate_identity_token(uid, options = {})
102
- check_presence!(uid, 'uid')
103
- symbolize_keys! options
104
-
105
- kind = options[:kind] || 'regular'
106
- plain_text = "v1;#{kind};#{uid}"
107
-
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)
125
+ make_graphql_request(TRACK_EVENT_REQUEST, { event: event, accountUid: uid, data: data })
115
126
  end
116
127
 
117
128
  def save_contacts(uid, contacts = [])
@@ -119,6 +130,10 @@ module DashX
119
130
  make_graphql_request(SAVE_CONTACTS_REQUEST, { uid: uid, contacts: contacts })
120
131
  end
121
132
 
133
+ def fetch_item(identifier)
134
+ make_graphql_request(FETCH_ITEM_REQUEST, { identifier: identifier })
135
+ end
136
+
122
137
  private
123
138
 
124
139
  def make_graphql_request(request, params)
data/lib/dashx/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module DashX
2
- VERSION = '0.3.0'.freeze
2
+ VERSION = '0.5.0'.freeze
3
3
  end
data/lib/dashx.rb CHANGED
@@ -23,11 +23,11 @@ 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
33
  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.3.0
4
+ version: 0.5.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-03-28 00:00:00.000000000 Z
11
+ date: 2023-01-03 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.0.8
70
- signing_key:
69
+ rubygems_version: 3.3.3
70
+ signing_key:
71
71
  specification_version: 4
72
72
  summary: DashX SDK for Ruby.
73
73
  test_files: []