qube_sync 0.2.0 → 0.2.2

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: 00eae4c872c5ce3b07d1957a64126395b4b5f1321183968d4198705c136182ac
4
- data.tar.gz: 19d7d5d9828ea9d12bbd0994a3bc1d57296a2523bd0e3c326c9710a16974dc45
3
+ metadata.gz: 2c593eb9ef22a2ba0aea163fcbeb42d5bebb543d68df3f109df1e107e84daecf
4
+ data.tar.gz: 84ecbe1882466ad81c466384a226e091d1cef477fba15afa91932f852757bd04
5
5
  SHA512:
6
- metadata.gz: 55d230f8f304254ccae852e3aed424d31791ac852854fc07dcaa45b967a47b642e3c062f0d7b557362ec95ac09c58cc9388b56c39cece6bd0955a82f9e8daf62
7
- data.tar.gz: 7c51738b3062d0e8fa0af4e066382194c961f54e20d528f00d2e26d595d7f6b13ba1f9b60ce0c6c00b19e424f28b3dff3d64a99df6b771b0a837c5c1e4099488
6
+ metadata.gz: 92ec4c4a1ec346e26f99e38f7bfc8c5be77b01393a416b85f015a608cf4dd0dcdac0c916ce32b14a011ced23b1a0fe88f37a22db937428ea1d9a5514a55c30cb
7
+ data.tar.gz: 4a74b0a77a1c3e2193f722938a95cfbe8dfb4c2d06db06baecf0fb8bed7c9d7b18e10b06811424c2140635d033ea01db40057b2e18fa74ce448dfe2b5d13f8d2
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
  # }
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module QubeSync
4
- VERSION = "0.2.0"
4
+ VERSION = "0.2.2"
5
5
  end
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(',') => [ts, *signatures]
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) => { timestamp:, signatures:}
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")
data/qube_sync.gemspec CHANGED
@@ -36,7 +36,7 @@ Gem::Specification.new do |spec|
36
36
  spec.require_paths = ["lib"]
37
37
 
38
38
  # Uncomment to register a new dependency of your gem
39
- spec.add_dependency "faraday"
39
+ spec.add_dependency "faraday", "~> 2.0"
40
40
 
41
41
 
42
42
  # For more information and examples about making a new gem, check out our
metadata CHANGED
@@ -1,29 +1,28 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: qube_sync
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Garrett Lancaster
8
- autorequire:
9
8
  bindir: exe
10
9
  cert_chain: []
11
- date: 2025-05-23 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: faraday
15
14
  requirement: !ruby/object:Gem::Requirement
16
15
  requirements:
17
- - - ">="
16
+ - - "~>"
18
17
  - !ruby/object:Gem::Version
19
- version: '0'
18
+ version: '2.0'
20
19
  type: :runtime
21
20
  prerelease: false
22
21
  version_requirements: !ruby/object:Gem::Requirement
23
22
  requirements:
24
- - - ">="
23
+ - - "~>"
25
24
  - !ruby/object:Gem::Version
26
- version: '0'
25
+ version: '2.0'
27
26
  description: "\n Easily create and manage QUBE Sync API resources in Ruby.\n\n Manage
28
27
  connections, queued requests, and more with the QUBE Sync API.\n "
29
28
  email:
@@ -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.5.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: []