spree-api-client 0.2.2 → 0.2.3

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: 87fb81b0e43fbc0f71d0d89478f1f299a2db9f76d859342c00bb0a1ac749133d
4
- data.tar.gz: 65ae1f52e4aaa6a22b03955ddbdf6b5c9974b502d1ced194cd09b8a4cafb61e6
3
+ metadata.gz: bdb452de010ece9605e8f57e419b5c0dc8570c71cadf1ec6b4a46b44bd54e19f
4
+ data.tar.gz: 1b21a6698ab40d88c05f4e7375aca47509564691071eaf6c861257f5233735ea
5
5
  SHA512:
6
- metadata.gz: 36d7e50bb7bb5a1addde638761ced2435037a33a4046ef8e3493cc7296faa050f008ccf8a6bbe5087dc6112fcc105a7c6ab510caf2a5f256b217d7f4ee7a89db
7
- data.tar.gz: '09f2b5e5cdc9bc2bc2b41fea5417c1ba1d0b87ac8a112d4afd1664e00145235b25b49551941dfb4a87d347dfc893cd77e209a94ca8aab9a256fce17a1981213d'
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
@@ -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.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-06-01 00:00:00.000000000 Z
11
+ date: 2021-07-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty