shopify_api 12.0.0 → 12.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f6e4e09aa88812707194b0ec0726f1e61f448647a01a9d0709201808c05ad99c
4
- data.tar.gz: ac3fcdb640bb6d1c1614e82d5faf9cd2fce496117187d2daca803a5d96ef8036
3
+ metadata.gz: f3c03360ffab3820b674ee42ec8cc8de1028aa852f07b9b09a1ffb111c81cf5b
4
+ data.tar.gz: 727487abd59263c77bdf81dd0e3af9f23914260b54d7fb132d834d5943939202
5
5
  SHA512:
6
- metadata.gz: c05d906a83000f3a2134875532798224afac9cf270787fadd493b2cc3d820771eac5e3b609766ff9c3d08138a774d8e681d3d93d3c13079d4b655d7a857dddf3
7
- data.tar.gz: 1b4088cd2457c8d39ec04b466a5dcf492ac62df751c44f359a12a1176ed4b30f4289ae2d8dc0a400c491b377ffc522d71e86b33f898b8ce086b39cec0729495e
6
+ metadata.gz: a4a7e438b3e0b16e5357c3dbb9f981dcb56bed718a3ea57fab5451b699427dcb651d12ac2a9f40393f6d85fcf0bf2eb737d789cd72540f38faeaed7e0fc3f0aa
7
+ data.tar.gz: b67a4fc69202ee4da880052bfc5e6e76c69611b099a555ce5318763c0e691484dab4c09b6b309c90c5475605a1d16a8867ba060ec2e01526b97d25eee86acaeb
@@ -14,6 +14,7 @@ jobs:
14
14
  with:
15
15
  days-before-issue-stale: 90
16
16
  days-before-issue-close: 14
17
+ operations-per-run: 1000
17
18
  stale-issue-label: "Stale"
18
19
  stale-issue-message: >
19
20
  This issue is stale because it has been open for 90 days with no activity. It will be closed if no further action occurs in 14 days.
data/CHANGELOG.md CHANGED
@@ -4,10 +4,13 @@ Note: For changes to the API, see https://shopify.dev/changelog?filter=api
4
4
 
5
5
  ## Unreleased
6
6
 
7
+ ## Version 12.1.0
8
+
9
+ - [#1017](https://github.com/Shopify/shopify-api-ruby/pull/1017) Add support for `http` with localhost development without using a TLS tunnel
10
+
7
11
  ## Version 12.0.0
8
12
 
9
13
  - [#1027](https://github.com/Shopify/shopify-api-ruby/pull/1027) ⚠️ [Breaking] Remove support for deprecated API version `2021-10` and added support for version `2022-10`
10
-
11
14
  - [#1008](https://github.com/Shopify/shopify-api-ruby/pull/1008) Increase session token JWT validation leeway from 5s to 10s
12
15
 
13
16
  ## Version 11.1.0
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- shopify_api (12.0.0)
4
+ shopify_api (12.1.0)
5
5
  concurrent-ruby
6
6
  hash_diff
7
7
  httparty
data/README.md CHANGED
@@ -25,8 +25,7 @@ To follow these usage guides, you will need to:
25
25
  - have a Shopify Partner account and development store
26
26
  - _OR_ have a test store where you can create a private app
27
27
  - have an app already set up in your test store or partner account
28
- - use [ngrok](https://ngrok.com/download) to create a secure tunnel to your app running on your localhost
29
- - add the `ngrok` URL and the appropriate redirect for your OAuth callback route to your app settings
28
+ - add the URL and the appropriate redirect for your OAuth callback route to your app settings
30
29
 
31
30
  ## Installation
32
31
 
@@ -31,7 +31,7 @@ module ShopifyAPI
31
31
  query = {
32
32
  client_id: ShopifyAPI::Context.api_key,
33
33
  scope: ShopifyAPI::Context.scope.to_s,
34
- redirect_uri: "https://#{ShopifyAPI::Context.host_name}#{redirect_path}",
34
+ redirect_uri: "#{ShopifyAPI::Context.host}#{redirect_path}",
35
35
  state: state,
36
36
  "grant_options[]": is_online ? "per-user" : "",
37
37
  }
@@ -36,6 +36,7 @@ module ShopifyAPI
36
36
  is_embedded: T::Boolean,
37
37
  session_storage: ShopifyAPI::Auth::SessionStorage,
38
38
  logger: Logger,
39
+ host: T.nilable(String),
39
40
  private_shop: T.nilable(String),
40
41
  user_agent_prefix: T.nilable(String),
41
42
  old_api_secret_key: T.nilable(String),
@@ -51,19 +52,21 @@ module ShopifyAPI
51
52
  is_embedded:,
52
53
  session_storage:,
53
54
  logger: Logger.new($stdout),
55
+ host: ENV["HOST"] || "https://#{host_name}",
54
56
  private_shop: nil,
55
57
  user_agent_prefix: nil,
56
58
  old_api_secret_key: nil
57
59
  )
58
60
  unless ShopifyAPI::AdminVersions::SUPPORTED_ADMIN_VERSIONS.include?(api_version)
59
61
  raise Errors::UnsupportedVersionError,
60
- "Invalid vession #{api_version}, supported versions: #{ShopifyAPI::AdminVersions::SUPPORTED_ADMIN_VERSIONS}"
62
+ "Invalid version #{api_version}, supported versions: #{ShopifyAPI::AdminVersions::SUPPORTED_ADMIN_VERSIONS}"
61
63
  end
62
64
 
63
65
  @api_key = api_key
64
66
  @api_secret_key = api_secret_key
65
67
  @api_version = api_version
66
68
  @host_name = host_name
69
+ @host = T.let(host, T.nilable(String))
67
70
  @is_private = is_private
68
71
  @scope = Auth::AuthScopes.new(scope)
69
72
  @is_embedded = is_embedded
@@ -122,7 +125,7 @@ module ShopifyAPI
122
125
  end
123
126
 
124
127
  sig { returns(T.nilable(String)) }
125
- attr_reader :private_shop, :user_agent_prefix, :old_api_secret_key
128
+ attr_reader :private_shop, :user_agent_prefix, :old_api_secret_key, :host
126
129
 
127
130
  sig { returns(T::Boolean) }
128
131
  def embedded?
@@ -131,7 +134,7 @@ module ShopifyAPI
131
134
 
132
135
  sig { returns(T::Boolean) }
133
136
  def setup?
134
- !(api_key.empty? || api_secret_key.empty? || host_name.empty?)
137
+ [api_key, api_secret_key, host_name, T.must(host)].none?(&:empty?)
135
138
  end
136
139
 
137
140
  sig { returns(T.nilable(Auth::Session)) }
@@ -150,6 +153,11 @@ module ShopifyAPI
150
153
  def deactivate_session
151
154
  @active_session.value = nil
152
155
  end
156
+
157
+ sig { returns(String) }
158
+ def host_scheme
159
+ T.must(URI.parse(T.must(host)).scheme)
160
+ end
153
161
  end
154
162
  end
155
163
  end
@@ -2,5 +2,5 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module ShopifyAPI
5
- VERSION = "12.0.0"
5
+ VERSION = "12.1.0"
6
6
  end
@@ -9,12 +9,12 @@ module ShopifyAPI
9
9
 
10
10
  sig { override.returns(String) }
11
11
  def callback_address
12
- if @path.match?(%r{^https://})
12
+ if @path.match?(%r{^https?://})
13
13
  @path
14
14
  elsif @path.match?(/^#{Context.host_name}/)
15
- "https://#{@path}"
15
+ "#{Context.host_scheme}://#{@path}"
16
16
  else
17
- "https://#{Context.host_name}/#{@path}"
17
+ "#{Context.host}/#{@path}"
18
18
  end
19
19
  end
20
20
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shopify_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 12.0.0
4
+ version: 12.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shopify
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-10-04 00:00:00.000000000 Z
11
+ date: 2022-10-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: concurrent-ruby