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 +4 -4
- data/lib/yahoo_store_api/version.rb +1 -1
- data/lib/yahoo_store_api.rb +8 -13
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7fa488df1fd962d30ed6ff5876af8f0be58f3be7155fe23df86ba0b9c7d910fe
|
4
|
+
data.tar.gz: fd2c8defe9a71a809b6bacbb6cd0a517897ba6681e00828bd1f721a75ca5aa48
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1fea9cdc46fe5b06c4cf129bc32e658b5a9dc57062ed7962e8d60600aeff4912d8e1b9ed76f32db0776af5ff0b51924e0bce49eb4dee5095ee82ed8e5fbf04f4
|
7
|
+
data.tar.gz: f077634770b61d3ce3a4b61035c63059e10143d1a1a87d2fc436411e705a4ac56cd7aea5b869d635f2ab66a97790833e6a2d7979d46bf6922debb63de09239f5
|
data/lib/yahoo_store_api.rb
CHANGED
@@ -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)
|
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
|
-
|
48
|
-
result =
|
49
|
-
@refresh_token = result[
|
50
|
-
result[
|
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
|
-
|
56
|
-
result =
|
55
|
+
response = access_token_connection.post { |r| r.body = param }
|
56
|
+
result = JSON.parse(response.body)
|
57
57
|
@refresh_token = refresh_token
|
58
|
-
result[
|
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.
|
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-
|
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.
|
242
|
+
rubygems_version: 3.2.32
|
243
243
|
signing_key:
|
244
244
|
specification_version: 4
|
245
245
|
summary: Yahoo!ショッピング プロフェッショナル出店ストア向けAPIを簡単に叩けるrubyラッパー
|