hubrise_client 2.0.14 → 2.0.15

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: 89e7c3b037501ae07c44e6cfef51a9e39d5d0aa06c229493716957835146c64e
4
- data.tar.gz: 34643d28e45cad280f62bc8e826cfaf0d7bbd19cedcd003faeeda087d3d5e428
3
+ metadata.gz: b05c00e55ba2498337eacf6f67d8d8e4c56a48d41c7bdb280dd475219efff7c6
4
+ data.tar.gz: '079dc44ad7cd1728fbf50fe5c8a6226d78615a8738a01655fe23e9ba8f5af056'
5
5
  SHA512:
6
- metadata.gz: 78e35af2ae3b43e4a3e73339abd261cbe515cddac733dbd930831f6fea512ec686683b4e681875d429d9d07edbe4d396ba44858d95a134ef6e4cab0c922a3852
7
- data.tar.gz: 15ad66f6d58e868117ead6678921b0f70b9954525b60e28930c0af6e599daca371f1faf6105399f904980d5dcb73bfc9ae2dfdf0f15bbadef88a2a972afd3bde
6
+ metadata.gz: 25477048e5358e52ed29bc5a32294dbfad3c9a703388bb8a5fa698c64fcc3a236596d0c1e70fe7f7c22217322ab6ce52881c35ade25b062599229d5828ef5a8c
7
+ data.tar.gz: 1e51ad7068e667ed17640456e80d6ecf3802bb7d1904ac6d0860f2f33a1a0939ef9654c81bbd4f5eb6f1f1808e8ceb98e38ab9f19d6a2977d8079303b3d92596
data/README.md CHANGED
@@ -14,59 +14,57 @@ Or install via [gem](http://rubygems.org/)
14
14
  gem install hubrise_client
15
15
  ```
16
16
 
17
-
18
17
  # Prerequisites
19
18
 
20
- 1) Read the [docs](https://www.hubrise.com/developers)
21
-
22
- 2) [Create a Hubrise Client](https://www.hubrise.com/developers/quick-start#create-the-oauth-client) to get your `CLIENT_ID` and `CLIENT_SECRET`.
19
+ 1. Read the [docs](https://www.hubrise.com/developers)
23
20
 
21
+ 2. [Create a Hubrise Client](https://www.hubrise.com/developers/quick-start#create-the-oauth-client) to get your `CLIENT_ID` and `CLIENT_SECRET`.
24
22
 
25
23
  # Get an access token
26
24
 
27
25
  1. Initialize anonymous `HubriseClient`
28
- ```ruby
29
- client = HubriseClient::V1.new(CLIENT_ID, CLIENT_SECRET)
30
- ```
26
+
27
+ ```ruby
28
+ client = HubriseClient::V1.new(CLIENT_ID, CLIENT_SECRET)
29
+ ```
31
30
 
32
31
  2. Prepare a route to handle `REDIRECT_URI` callback
33
- ```ruby
34
- # routes.rb
35
- namespace :hubrise_oauth do
36
- get :authorize_callback
37
- # => creates hubrise_oauth_authorize_callback_url helper
38
- end
39
- ```
40
-
41
32
 
42
- 3. Initiate an OAuth flow by redirecting a user to [OAuth Authorization URL](https://www.hubrise.com/developers/authentication#request-authorisation)
43
- ```ruby
44
- oauth_scope = "location[orders.read]" # adjust to your needs
45
- authorization_url = client.build_authorization_url(hubrise_oauth_authorize_callback_url, oauth_scope)
46
- ...
47
- redirect_to(authorization_url)
48
- ```
33
+ ```ruby
34
+ # routes.rb
35
+ namespace :hubrise_oauth do
36
+ get :authorize_callback
37
+ # => creates hubrise_oauth_authorize_callback_url helper
38
+ end
39
+ ```
49
40
 
50
- 4. Complete the OAuth flow
41
+ 3. Initiate an OAuth flow by redirecting a user to [OAuth Authorization URL](https://www.hubrise.com/developers/authentication#request-authorisation)
51
42
 
52
- Once the user accepts your request he or she will be redirected to the REDIRECT_URI
53
- At this step you need to [exchange](https://www.hubrise.com/developers/authentication#get-an-access-token) the `authorization_code` (received as a query param) for a new `access_token`
43
+ ```ruby
44
+ oauth_scope = "location[orders.read]" # adjust to your needs
45
+ authorization_url = client.build_authorization_url(hubrise_oauth_authorize_callback_url, oauth_scope)
46
+ ...
47
+ redirect_to(authorization_url)
48
+ ```
54
49
 
50
+ 4. Complete the OAuth flow
55
51
 
56
- ```ruby
57
- # controllers/hubrise_oauth_controller.rb
52
+ Once the user accepts your request he or she will be redirected to the REDIRECT_URI
53
+ At this step you need to [exchange](https://www.hubrise.com/developers/authentication#get-an-access-token) the `authorization_code` (received as a query param) for a new `access_token`
58
54
 
59
- def authorize_callback
60
- client.authorize!(params[:code])
55
+ ```ruby
56
+ # controllers/hubrise_oauth_controller.rb
61
57
 
62
- current_user.update!(hubrise_access_token: client.access_token)
63
- # account_id = client.account_id
64
- # location_id = client.location_id
65
- end
66
- ```
58
+ def authorize_callback
59
+ client.authorize!(params[:code])
67
60
 
68
- The `access_token` reffers to this specific user's permission so it should be securely persisted and not shared with other users.
61
+ current_user.update!(hubrise_access_token: client.access_token)
62
+ # account_id = client.account_id
63
+ # location_id = client.location_id
64
+ end
65
+ ```
69
66
 
67
+ The `access_token` reffers to this specific user's permission so it should be securely persisted and not shared with other users.
70
68
 
71
69
  # Use the access token
72
70
 
@@ -75,6 +73,7 @@ client = HubriseClient::V1.new(CLIENT_ID, CLIENT_SECRET, access_token: current_u
75
73
  ```
76
74
 
77
75
  Now you can call the [helper methods](https://github.com/HubRise/ruby-client/blob/master/V1_ENDPOINTS.md) on behalf of the user
76
+
78
77
  ```ruby
79
78
  client.get_account
80
79
  ```
@@ -98,7 +97,16 @@ response.each_page do |page_response|
98
97
  end
99
98
  ```
100
99
 
101
- # Publish changes to this gem
100
+ # Development
101
+
102
+ ## Run tests
103
+
104
+ ```bash
105
+ bundle install
106
+ bundle exec rspec
107
+ ```
108
+
109
+ ## Release
102
110
 
103
111
  1. Make sure all local changes are committed.
104
112
 
@@ -107,7 +115,7 @@ end
107
115
  3. Tag the repository:
108
116
 
109
117
  ```bash
110
- VERSION=2.0.14
118
+ VERSION=2.0.9
111
119
  git add lib/hubrise_client/version.rb
112
120
  git commit -m "Version $VERSION"
113
121
  git tag v$VERSION
@@ -122,4 +130,4 @@ rm -f hubrise_client-*.gem
122
130
  gem build hubrise_client
123
131
  gem push hubrise_client-*.gem
124
132
  rm -f hubrise_client-*.gem
125
- ```
133
+ ```
@@ -177,10 +177,10 @@ module HubriseClient
177
177
  # --------------------
178
178
  # Images
179
179
  # --------------------
180
- def create_image(data, mime_type, catalog_id = nil)
181
- call_api("/catalogs/#{catalog_id_fallback(catalog_id)}/images", :post, data: data,
182
- headers: { "Content-Type" => mime_type },
183
- json: false)
180
+ def create_image(data, mime_type, catalog_id = nil, options = {})
181
+ path = "/catalogs/#{catalog_id_fallback(catalog_id)}/images"
182
+ path += "?private_ref=#{CGI.escape(options[:private_ref])}" if options[:private_ref]
183
+ call_api(path, :post, data: data, headers: { "Content-Type" => mime_type }, json: false)
184
184
  end
185
185
 
186
186
  def get_images(catalog_id = nil)
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module HubriseClient
3
- VERSION = "2.0.14"
3
+ VERSION = "2.0.15"
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hubrise_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.14
4
+ version: 2.0.15
5
5
  platform: ruby
6
6
  authors:
7
7
  - Antoine Monnier
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2025-04-11 00:00:00.000000000 Z
12
+ date: 2025-06-12 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description:
15
15
  email: