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 +4 -4
- data/README.md +34 -75
- data/lib/dashx/client.rb +33 -18
- data/lib/dashx/version.rb +1 -1
- data/lib/dashx.rb +4 -4
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b0aada5ee24fcb39cdf0963c82aaa861a07f4837f4147b0ed2b96349a19b88f5
|
4
|
+
data.tar.gz: '08e1160582de21e8c92165b5102bea7a358b1078cddff04dc0340d016a849aa7'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 922481e88e687b49ffb637459f6491f9599481370d9370c34c03a496fb35b82ea9834eabb8440b7e47ac94bd60851792a171c71732c4dcb29a320599206fe3d8
|
7
|
+
data.tar.gz: 67a9f73f7000937dfa1c6b56fc50f7f7d5225b5ebafff2376033e468b97c6fc1e055f72fbaa4e722cf1bf4bf8b213f89094495c83b9c5837bff404bc7a91bd71
|
data/README.md
CHANGED
@@ -1,93 +1,56 @@
|
|
1
|
-
|
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
|
-
|
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
|
-
|
19
|
+
<br />
|
6
20
|
|
7
|
-
|
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
|
-
|
23
|
+
_DashX SDK for Ruby_
|
20
24
|
|
21
|
-
##
|
22
|
-
|
23
|
-
```ruby
|
24
|
-
require 'dashx'
|
25
|
-
|
26
|
-
DashX.deliver({ to: 'johndoe@example.com' })
|
27
|
-
```
|
25
|
+
## Install
|
28
26
|
|
29
|
-
|
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
|
-
|
42
|
-
to: 'John Doe <john@example.com>',
|
43
|
-
body: 'Hello World!'
|
44
|
-
});
|
30
|
+
gem 'dashx'
|
45
31
|
```
|
46
32
|
|
47
|
-
|
33
|
+
And then execute:
|
48
34
|
|
49
|
-
```
|
50
|
-
|
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
|
-
|
57
|
-
|
58
|
-
You can use `identify` to update user info associated with the provided `uid`
|
39
|
+
Or install it yourself as:
|
59
40
|
|
60
|
-
```
|
61
|
-
|
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
|
-
|
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
|
-
|
47
|
+
For detailed usage, refer to the [documentation](https://docs.dashx.com/developer).
|
83
48
|
|
84
|
-
|
49
|
+
## Contributing
|
85
50
|
|
86
|
-
|
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
|
-
|
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
|
-
|
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
|
-
|
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,
|
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
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.
|
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:
|
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.
|
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: []
|