yahoo_store_api 0.2.5 → 0.2.6

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: cc0e2477c4f680e362595d10e094e2ad91fd0ac6cd41a89fbbe08728d1937007
4
- data.tar.gz: 6be1e3443b3e400ffc3e575dea1861a5d91a105d656eccbdc8821583e6779239
3
+ metadata.gz: 7fa488df1fd962d30ed6ff5876af8f0be58f3be7155fe23df86ba0b9c7d910fe
4
+ data.tar.gz: fd2c8defe9a71a809b6bacbb6cd0a517897ba6681e00828bd1f721a75ca5aa48
5
5
  SHA512:
6
- metadata.gz: 561646417f09b28521617c48ed33e1afb6d3f32011bcb52c16ad50a4f3e41f6c2db8b9d4cb704a15a98b74ab733033043c6a87bd5cb5fa6235715fda18064cd4
7
- data.tar.gz: 98df0a5737ceae790cd59598d4e45980072c7bc3f8dcb5eda621d949312eb516d4f369afbd0caf03103f98292c770056de6de68b9e99fa04ffd915b9612004f3
6
+ metadata.gz: 1fea9cdc46fe5b06c4cf129bc32e658b5a9dc57062ed7962e8d60600aeff4912d8e1b9ed76f32db0776af5ff0b51924e0bce49eb4dee5095ee82ed8e5fbf04f4
7
+ data.tar.gz: f077634770b61d3ce3a4b61035c63059e10143d1a1a87d2fc436411e705a4ac56cd7aea5b869d635f2ab66a97790833e6a2d7979d46bf6922debb63de09239f5
@@ -1,3 +1,3 @@
1
1
  module YahooStoreApi
2
- VERSION = "0.2.5"
2
+ VERSION = "0.2.6"
3
3
  end
@@ -27,7 +27,7 @@ module YahooStoreApi
27
27
  @application_id = application_id
28
28
  @application_secret = application_secret
29
29
  @redirect_uri = redirect_uri ? "&redirect_uri=" + CGI.escape(redirect_uri) : nil
30
- @access_token = refresh_access_token(refresh_token) || get_access_token(authorization_code)
30
+ @access_token = refresh_token.present? ? refresh_access_token(refresh_token) : get_access_token(authorization_code)
31
31
  end
32
32
 
33
33
  private
@@ -44,23 +44,18 @@ module YahooStoreApi
44
44
 
45
45
  def get_access_token(authorization_code)
46
46
  param = "grant_type=authorization_code&code=#{authorization_code}#{@redirect_uri}"
47
- obj = access_token_connection.post { |r| r.body = param }
48
- result = hash_converter(obj)
49
- @refresh_token = result[:refresh_token]
50
- result[:access_token]
47
+ response = access_token_connection.post { |r| r.body = param }
48
+ result = JSON.parse(response.body)
49
+ @refresh_token = result["refresh_token"]
50
+ result["access_token"]
51
51
  end
52
52
 
53
53
  def refresh_access_token(refresh_token)
54
54
  param = "grant_type=refresh_token&refresh_token=#{refresh_token}"
55
- obj = access_token_connection.post { |r| r.body = param }
56
- result = hash_converter(obj)
55
+ response = access_token_connection.post { |r| r.body = param }
56
+ result = JSON.parse(response.body)
57
57
  @refresh_token = refresh_token
58
- result[:access_token]
59
- end
60
-
61
- def hash_converter(str)
62
- ary = str.body.delete('"{}').split(/[:,]/)
63
- ary.each_slice(2).map { |k, v| [k.to_sym, v] }.to_h
58
+ result["access_token"]
64
59
  end
65
60
  end
66
61
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yahoo_store_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.5
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - t4traw
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-04-04 00:00:00.000000000 Z
11
+ date: 2022-04-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -239,7 +239,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
239
239
  - !ruby/object:Gem::Version
240
240
  version: '0'
241
241
  requirements: []
242
- rubygems_version: 3.2.3
242
+ rubygems_version: 3.2.32
243
243
  signing_key:
244
244
  specification_version: 4
245
245
  summary: Yahoo!ショッピング プロフェッショナル出店ストア向けAPIを簡単に叩けるrubyラッパー