spree-api-client 0.2.2 → 0.2.3
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 -1
- data/lib/spree_client/api/v1.rb +4 -3
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bdb452de010ece9605e8f57e419b5c0dc8570c71cadf1ec6b4a46b44bd54e19f
|
4
|
+
data.tar.gz: 1b21a6698ab40d88c05f4e7375aca47509564691071eaf6c861257f5233735ea
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 76964aba29ad2d91fd8113068d14c9e53c07be7e1c0ff118db3604b01864367f4368fb5ce73e590d06a0bda57a202abd74a4fdaddec13cb9f5dcede357fea17a
|
7
|
+
data.tar.gz: 6be8f467279351f436cc9f2e214dc65391ae7422a94a21b13e26e7fef5d07b49b555f130e166cf2c80a368b12cc312fd6016a781a03eb123cec2660e73c6045d
|
data/README.md
CHANGED
@@ -21,7 +21,7 @@ Or install it yourself as:
|
|
21
21
|
Get an API key for your user in `/admin/users`.
|
22
22
|
|
23
23
|
```ruby
|
24
|
-
spree = SpreeClient::Api::V1.new api_key: 'api key', spree_url: 'http://localhost:3000'
|
24
|
+
spree = SpreeClient::Api::V1.new api_key: 'api key', spree_url: 'http://localhost:3000', store: 'https://my.store'
|
25
25
|
|
26
26
|
spree.products.index
|
27
27
|
=> true
|
data/lib/spree_client/api/v1.rb
CHANGED
@@ -11,10 +11,11 @@ module SpreeClient
|
|
11
11
|
class V1
|
12
12
|
include ::HTTParty
|
13
13
|
|
14
|
-
attr_reader :api_key
|
14
|
+
attr_reader :api_key, :store
|
15
15
|
|
16
|
-
def initialize(api_key:, spree_url: 'http://localhost:3000')
|
16
|
+
def initialize(api_key:, spree_url: 'http://localhost:3000', store: nil)
|
17
17
|
@api_key = api_key
|
18
|
+
@store = HTTParty.normalize_base_uri(store) if store
|
18
19
|
self.class.default_options[:base_uri] = HTTParty.normalize_base_uri(spree_url)
|
19
20
|
end
|
20
21
|
|
@@ -45,7 +46,7 @@ module SpreeClient
|
|
45
46
|
end
|
46
47
|
|
47
48
|
def headers(extra = {})
|
48
|
-
extra.merge({ 'Content-Type' => 'application/json', 'X-Spree-Token' => api_key })
|
49
|
+
extra.merge({ 'Content-Type' => 'application/json', 'X-Spree-Token' => api_key, 'Origin' => store })
|
49
50
|
end
|
50
51
|
end
|
51
52
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: spree-api-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- f
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-07-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|