qube_sync 0.2.0 → 0.2.1
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 +1 -4
- data/lib/qube_sync/version.rb +1 -1
- data/lib/qube_sync.rb +7 -4
- metadata +3 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b2c9e1ca88def822a5954628f1b5d336eab0f3e8ba210871c91abc29cc626b93
|
4
|
+
data.tar.gz: eb86ac186eeba798fe0eeeb18179bedf4e83eedca1906a359f5a6ee17d1f0940
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b50b747fff6d9ccfeb7914e63d689fe62479166e71cbe8fed086da10b973e5a96427d54a432513bbd6b3a05f923897c11e29108c9493458fd31a0210d1e2b571
|
7
|
+
data.tar.gz: 74486d4d0f6ca5da0c3521bcb01407d4fc9b32a7e76dce69784bccc5b8dc96ed966d13e0ccb12366d1ff1a78608587a09f5d33877fd48320c0f65b349ad2550a
|
data/README.md
CHANGED
@@ -27,10 +27,6 @@ require 'qube_sync'
|
|
27
27
|
connection_id = QubeSync.create_connection # creates a connection in QUBE on behalf of your user
|
28
28
|
#=> "636d4750-0b07-45f6-a030-e3919c5741ff"
|
29
29
|
|
30
|
-
# You can also pass a block to create_connection as a success callback
|
31
|
-
QubeSync.create_connection do |connection_id|
|
32
|
-
QubeConnection.create!(qube_id: connection_id) # save the connection_id to your database
|
33
|
-
end
|
34
30
|
|
35
31
|
QubeSync.delete_connection("asdf-qwer-asdf-zxcv") # deletes the connection in QUBE
|
36
32
|
#=> true
|
@@ -117,6 +113,7 @@ QubeSync.verify_and_build_webhook!(request.body.read, request.headers['X-Qube-Si
|
|
117
113
|
#=> {
|
118
114
|
# "id"=>"dd8db40a-5169-477a-b9d5-f1a6e5cc96f9",
|
119
115
|
# "timestamp"=>1738620998,
|
116
|
+
# "response_json"=> {...},
|
120
117
|
# "response_xml"=>
|
121
118
|
# "<?xml version=\"1.0\" ?> <QBXML> <QBXMLMsgsRs> ... </QBXMLMsgsRs> </QBXML>"
|
122
119
|
# }
|
data/lib/qube_sync/version.rb
CHANGED
data/lib/qube_sync.rb
CHANGED
@@ -122,12 +122,15 @@ module QubeSync
|
|
122
122
|
|
123
123
|
|
124
124
|
def extract_signature_meta(header)
|
125
|
-
header.split(',')
|
125
|
+
parts = header.split(',')
|
126
|
+
ts = parts.first
|
127
|
+
signatures = parts[1..-1]
|
126
128
|
{
|
127
129
|
timestamp: ts.split("=").last.to_i,
|
128
130
|
signatures: signatures
|
129
131
|
}
|
130
132
|
end
|
133
|
+
|
131
134
|
|
132
135
|
def default_headers
|
133
136
|
{
|
@@ -153,13 +156,13 @@ module QubeSync
|
|
153
156
|
end
|
154
157
|
|
155
158
|
def verify_and_build_webhook!(body, signature, max_age: 500)
|
156
|
-
extract_signature_meta(signature)
|
159
|
+
meta = extract_signature_meta(signature)
|
157
160
|
|
158
|
-
if timestamp < Time.now.to_i - max_age
|
161
|
+
if meta[:timestamp] < Time.now.to_i - max_age
|
159
162
|
raise StaleWebhookError.new('Timestamp more than #{max_age}ms old. To increase this, pass a different value for max_age.')
|
160
163
|
end
|
161
164
|
|
162
|
-
if signatures.detect { |sig| sign_payload(body) == sig }
|
165
|
+
if meta[:signatures].detect { |sig| sign_payload(body) == sig }
|
163
166
|
JSON.parse(body)
|
164
167
|
else
|
165
168
|
raise InvalidWebhookSignatureError.new("Webhook signature mismatch")
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: qube_sync
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Garrett Lancaster
|
8
|
-
autorequire:
|
9
8
|
bindir: exe
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: faraday
|
@@ -48,7 +47,6 @@ metadata:
|
|
48
47
|
homepage_uri: https://github.com/qubeintegrations/qube_sync_rb
|
49
48
|
source_code_uri: https://github.com/qubeintegrations/qube_sync_rb
|
50
49
|
changelog_uri: https://github.com/qubeintegrations/qube_sync_rb/blob/main/CHANGELOG.md
|
51
|
-
post_install_message:
|
52
50
|
rdoc_options: []
|
53
51
|
require_paths:
|
54
52
|
- lib
|
@@ -63,8 +61,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
63
61
|
- !ruby/object:Gem::Version
|
64
62
|
version: '0'
|
65
63
|
requirements: []
|
66
|
-
rubygems_version: 3.
|
67
|
-
signing_key:
|
64
|
+
rubygems_version: 3.6.9
|
68
65
|
specification_version: 4
|
69
66
|
summary: Ruby library for the QUBE Sync API
|
70
67
|
test_files: []
|