yahoo_store_api 0.1.2 → 0.1.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
  SHA1:
3
- metadata.gz: d9e908e0799aac49b3bc5165e24f167f8f01742e
4
- data.tar.gz: '08bfd192bbc39794560aafdac3d8ffc9463ff05b'
3
+ metadata.gz: baa877ef1f03f53e2371b1c51329b99dd17db6a7
4
+ data.tar.gz: 23e84ae0da077cfd93258ddc8f3135740e89e917
5
5
  SHA512:
6
- metadata.gz: 5f1d2e26d94671091fcb770724aed351fc916efb38a10d75b2d0f3151a3dfd5afa07c66bb6b83bd22b29bc18279df741c57ae5870a39620e56068350b3ec7e5b
7
- data.tar.gz: 0e55ad4a4794ff54a3394e54c83bb3710a2575cc318f62a4a6ec67fd4b1bf3045b1734e81b492cd2ae8ba9f19286b1c02efe21e0bdf4e535af67285ef3d2e5ed
6
+ metadata.gz: df81ba8469481e68b6fa98501419723b25d336964844f318e2c19cb5794d932fc93118aeb6135cfebd1aee4a69a2cafd62035bcfe74e9a9eee774f50b1624336
7
+ data.tar.gz: 53374cf71011812ecf8b119d9c3dafc5e282c28df37e7a8723338cc3bfe87f121f0cefa11ddf51e7f61977a1d641f17014836fcb941a1c1bfcb18dcc2bfa5ab1
data/README.md CHANGED
@@ -43,11 +43,14 @@ stateやnonceなどは[Authorizationエンドポイント](https://developer.yah
43
43
 
44
44
  ストアアカウント、上で登録したアプリケーションid、シークレット、取得した認証コードでインスタンスを生成します。
45
45
 
46
+ redirect_uriにはアプリケーション登録時に設定したフルURL(もしくはカスタムURIスキーム)を指定してください。登録済みの戻り先URLが1つしかない場合は省略可能です。戻り先URLがない場合はoobを指定してください。
47
+
46
48
  ```ruby
47
49
  client = YahooStoreApi::Client.new(
48
50
  seller_id: YOUR_STORE_ID, # ストアアカウントid
49
51
  application_id: YOUR_APPLICATION_ID, # アプリケーションid
50
52
  application_secret: YOUR_SECRET, # シークレット
53
+ redirect_uri: 'oob', # 省略可能
51
54
  authorization_code: AUTHORIZATION_CODE # 認証コード
52
55
  )
53
56
  ```
@@ -7,6 +7,7 @@ require 'yahoo_store_api/publish.rb'
7
7
  require 'rexml/document'
8
8
  require 'yaml'
9
9
  require 'uri'
10
+ require 'cgi'
10
11
  require 'faraday'
11
12
  require 'active_support'
12
13
  require 'active_support/core_ext'
@@ -19,10 +20,11 @@ module YahooStoreApi
19
20
  include YahooStoreApi::Stock
20
21
  include YahooStoreApi::Publish
21
22
 
22
- def initialize(seller_id:, application_id:, application_secret:, authorization_code: nil, refresh_token: nil)
23
+ def initialize(seller_id:, application_id:, application_secret:, authorization_code: nil, redirect_uri: nil, refresh_token: nil)
23
24
  @seller_id = seller_id
24
25
  @application_id = application_id
25
26
  @application_secret = application_secret
27
+ @redirect_uri = redirect_uri ? "&redirect_uri=" + CGI.escape(redirect_uri) : nil
26
28
  @access_token = reflesh_access_token(refresh_token) || get_access_token(authorization_code)
27
29
  end
28
30
 
@@ -38,7 +40,7 @@ module YahooStoreApi
38
40
  end
39
41
 
40
42
  def get_access_token(authorization_code)
41
- param = "grant_type=authorization_code&code=#{authorization_code}&redirect_uri=oob"
43
+ param = "grant_type=authorization_code&code=#{authorization_code}#{@redirect_uri}"
42
44
  obj = access_token_connection.post{|r| r.body = param}
43
45
  result = hash_converter(obj)
44
46
  @refresh_token = result[:refresh_token]
@@ -1,3 +1,3 @@
1
1
  module YahooStoreApi
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  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.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - t4traw
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-06-23 00:00:00.000000000 Z
11
+ date: 2017-06-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday