yahoo_store_api 0.2.0 → 0.2.5

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: f425884881906edb17b5b1901b37091ca193f0e14190bb6cacc1fc62c3d58856
4
- data.tar.gz: 316bd70561649a4a1b7620c754fadc7d04138732fde60b3c46f9aca3421fafdb
3
+ metadata.gz: cc0e2477c4f680e362595d10e094e2ad91fd0ac6cd41a89fbbe08728d1937007
4
+ data.tar.gz: 6be1e3443b3e400ffc3e575dea1861a5d91a105d656eccbdc8821583e6779239
5
5
  SHA512:
6
- metadata.gz: 3338a934453cdff5a9d72c2577784449966f78e50addbeb7fd1b5246200a82c705b2b58ff7c2d0c4358a4e44dc352c753d6e5f5f9b83fafda02e7eda076c6122
7
- data.tar.gz: ff49e75c26dfef845a4af1c5cf6948c4763c9bfdbf00e813fe2425e7669b2775a0d875f90174035b9e93c7e75cd3a9a62e059740c6bf3ef6731fd58f24b2fbcd
6
+ metadata.gz: 561646417f09b28521617c48ed33e1afb6d3f32011bcb52c16ad50a4f3e41f6c2db8b9d4cb704a15a98b74ab733033043c6a87bd5cb5fa6235715fda18064cd4
7
+ data.tar.gz: 98df0a5737ceae790cd59598d4e45980072c7bc3f8dcb5eda621d949312eb516d4f369afbd0caf03103f98292c770056de6de68b9e99fa04ffd915b9612004f3
@@ -0,0 +1,41 @@
1
+ name: Ruby
2
+
3
+ on: [push]
4
+
5
+ jobs:
6
+ build:
7
+ runs-on: ubuntu-latest
8
+ strategy:
9
+ matrix:
10
+ ruby: [2.5, 2.6, 2.7, 3.0]
11
+ name: Ruby ${{ matrix.ruby }}
12
+
13
+ steps:
14
+ - uses: actions/checkout@v2
15
+ - uses: actions/cache@v2
16
+ with:
17
+ path: vendor/bundle
18
+ key: bundle-${{ hashFiles('**/Gemfile.lock') }}
19
+
20
+ - name: Set up Ruby
21
+ uses: actions/setup-ruby@v1
22
+ with:
23
+ ruby-version: ${{ matrix.ruby }}
24
+ bundler-cache: true
25
+
26
+ - name: Install bundler
27
+ run: gem install bundler
28
+
29
+ - name: Bundle install
30
+ run: bundle install --jobs 4 --retry 3
31
+ env:
32
+ RAILS_ENV: test
33
+
34
+ - name: Run test
35
+ run: rake test
36
+ env:
37
+ RAILS_ENV: test
38
+ YOUR_SELLER_ID: YOUR_SELLER_ID
39
+ YOUR_APPLICATION_ID: YOUR_APPLICATION_ID
40
+ YOUR_APPLICATION_SECRET: YOUR_APPLICATION_SECRET
41
+ YOUR_REFRESH_TOKEN: YOUR_REFRESH_TOKEN
data/.gitignore CHANGED
@@ -10,4 +10,7 @@
10
10
 
11
11
  .env
12
12
  .rbenv-gemsets
13
- sample.rb
13
+ .DS_Store
14
+ *.csv
15
+ sample.rb
16
+ .idea
@@ -0,0 +1,8 @@
1
+ {
2
+ "workbench.colorCustomizations": {
3
+ "titleBar.activeBackground": "#FA0133",
4
+ "titleBar.activeForeground": "#000000",
5
+ "activityBar.background": "#FA0133",
6
+ "activityBar.foreground": "#000000"
7
+ }
8
+ }
data/README.md CHANGED
@@ -1,12 +1,20 @@
1
1
  # YahooStoreApi
2
2
 
3
- [![Build Status](https://travis-ci.org/t4traw/yahoo_store_api.svg?branch=master)](https://travis-ci.org/t4traw/yahoo_store_api)
3
+ **⚠️Deprecated⚠️**
4
+
5
+ YahooのAPI認証がv1からv2に移行しており、自分自身EC関連の業務から離れているため、メンテナンスができません。
6
+
7
+ > 2021年8月3日をもちましてYahoo! ID連携 v1の新規の登録を終了いたしました。
8
+ > 2022年4月27日にYahoo! ID連携 v1の利用を終了いたしますのでv2への移行が必要です。
9
+
10
+ ---
11
+
12
+ [![Gem Version](https://badge.fury.io/rb/yahoo_store_api.svg)](https://badge.fury.io/rb/yahoo_store_api)
13
+ [![Ruby](https://github.com/t4traw/yahoo_store_api/actions/workflows/main.yml/badge.svg)](https://github.com/t4traw/yahoo_store_api/actions/workflows/main.yml)
4
14
  [![Code Climate](https://codeclimate.com/github/t4traw/yahoo_store_api/badges/gpa.svg)](https://codeclimate.com/github/t4traw/yahoo_store_api)
5
15
 
6
16
  Yahoo!ショッピング プロフェッショナル出店ストア向けAPIを簡単に叩けるrubyラッパーです。
7
17
 
8
- 現在開発中です🐛 まだ商品情報のCRUDと在庫情報の取得・更新、反映予約しかできません。順次機能追加をしていきたいと思います。
9
-
10
18
  ## できること
11
19
 
12
20
  * 商品に関連するAPI
@@ -14,6 +22,8 @@ Yahoo!ショッピング プロフェッショナル出店ストア向けAPIを
14
22
  * 商品登録API(`set_item`)
15
23
  * 商品アップロードAPI(`upload_item_file`)
16
24
  * 商品削除API(`delete_item`)
25
+ * 画像に関連するAPI
26
+ * 商品画像一括アップロードAPI(`upload_item_image_pack`)
17
27
  * 在庫に関連するAPI
18
28
  * 在庫参照API(`get_stock`)
19
29
  * 在庫更新API(`set_stock`)
@@ -4,9 +4,7 @@ module YahooStoreApi
4
4
 
5
5
  def connection(method, with_seller_id: false)
6
6
  url = ENDPOINT + method
7
- if with_seller_id
8
- url += "?seller_id=#{@seller_id}" if with_seller_id
9
- end
7
+ url += "?seller_id=#{@seller_id}" if with_seller_id
10
8
 
11
9
  Faraday.new(url: url) do |c|
12
10
  c.request :multipart
@@ -0,0 +1,15 @@
1
+ module YahooStoreApi
2
+ module Image
3
+ include YahooStoreApi::Helper
4
+
5
+ def upload_item_image_pack(zip_path)
6
+ request = {
7
+ file: Faraday::UploadIO.new(zip_path, "application/zip"),
8
+ }
9
+
10
+ handler connection("uploadItemImagePack", with_seller_id: true).post { |r|
11
+ r.body = request
12
+ }
13
+ end
14
+ end
15
+ end
@@ -0,0 +1 @@
1
+ require "yahoo_store_api/image/upload_item_image_pack"
@@ -1,3 +1,3 @@
1
1
  module YahooStoreApi
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.5"
3
3
  end
@@ -1,6 +1,7 @@
1
1
  require "yahoo_store_api/version"
2
2
  require "yahoo_store_api/helper.rb"
3
3
  require "yahoo_store_api/item.rb"
4
+ require "yahoo_store_api/image.rb"
4
5
  require "yahoo_store_api/stock.rb"
5
6
  require "yahoo_store_api/publish.rb"
6
7
 
@@ -17,6 +18,7 @@ module YahooStoreApi
17
18
  class Client
18
19
  attr_reader :refresh_token
19
20
  include YahooStoreApi::Item
21
+ include YahooStoreApi::Image
20
22
  include YahooStoreApi::Stock
21
23
  include YahooStoreApi::Publish
22
24
 
@@ -25,17 +27,17 @@ module YahooStoreApi
25
27
  @application_id = application_id
26
28
  @application_secret = application_secret
27
29
  @redirect_uri = redirect_uri ? "&redirect_uri=" + CGI.escape(redirect_uri) : nil
28
- @access_token = reflesh_access_token(refresh_token) || get_access_token(authorization_code)
30
+ @access_token = refresh_access_token(refresh_token) || get_access_token(authorization_code)
29
31
  end
30
32
 
31
33
  private
32
34
 
33
- ACCESS_TOKEN_ENDPOINT = "https://auth.login.yahoo.co.jp/yconnect/v1/token".freeze
35
+ ACCESS_TOKEN_ENDPOINT = "https://auth.login.yahoo.co.jp/yconnect/v2/token".freeze
34
36
 
35
37
  def access_token_connection
36
38
  Faraday.new(url: ACCESS_TOKEN_ENDPOINT) do |c|
37
39
  c.adapter Faraday.default_adapter
38
- c.authorization :Basic, Base64.strict_encode64("#{@application_id}:#{@application_secret}")
40
+ c.request :authorization, :Basic, Base64.strict_encode64("#{@application_id}:#{@application_secret}")
39
41
  c.headers["Content-Type"] = "application/x-www-form-urlencoded;charset=UTF-8"
40
42
  end
41
43
  end
@@ -48,7 +50,7 @@ module YahooStoreApi
48
50
  result[:access_token]
49
51
  end
50
52
 
51
- def reflesh_access_token(refresh_token)
53
+ def refresh_access_token(refresh_token)
52
54
  param = "grant_type=refresh_token&refresh_token=#{refresh_token}"
53
55
  obj = access_token_connection.post { |r| r.body = param }
54
56
  result = hash_converter(obj)
@@ -21,15 +21,15 @@ Gem::Specification.new do |spec|
21
21
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
22
  spec.require_paths = ["lib"]
23
23
 
24
- spec.add_dependency "faraday", ">= 0.12.1"
25
- spec.add_dependency "activesupport", ">= 4.2.8"
26
- spec.add_dependency "activemodel", ">= 4.2.8"
24
+ spec.add_dependency "faraday", "~> 1.8.0"
25
+ spec.add_dependency "activesupport", ">= 4.2.8", "< 7.0"
26
+ spec.add_dependency "activemodel", ">= 4.2.8", "< 7.0"
27
27
  spec.add_dependency "builder"
28
28
 
29
29
  spec.add_development_dependency "bundler"
30
30
  spec.add_development_dependency "rake", ">= 12.3.3"
31
- spec.add_development_dependency "pry", "~> 0.10.4"
32
- spec.add_development_dependency "minitest", "~> 5.0"
31
+ spec.add_development_dependency "pry", "~> 0.14"
32
+ spec.add_development_dependency "minitest", "~> 5.12"
33
33
  spec.add_development_dependency "minitest-reporters"
34
34
  spec.add_development_dependency "webmock"
35
35
  spec.add_development_dependency "vcr"
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yahoo_store_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - t4traw
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-09-22 00:00:00.000000000 Z
11
+ date: 2022-04-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.12.1
19
+ version: 1.8.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 0.12.1
26
+ version: 1.8.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: activesupport
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -31,6 +31,9 @@ dependencies:
31
31
  - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: 4.2.8
34
+ - - "<"
35
+ - !ruby/object:Gem::Version
36
+ version: '7.0'
34
37
  type: :runtime
35
38
  prerelease: false
36
39
  version_requirements: !ruby/object:Gem::Requirement
@@ -38,6 +41,9 @@ dependencies:
38
41
  - - ">="
39
42
  - !ruby/object:Gem::Version
40
43
  version: 4.2.8
44
+ - - "<"
45
+ - !ruby/object:Gem::Version
46
+ version: '7.0'
41
47
  - !ruby/object:Gem::Dependency
42
48
  name: activemodel
43
49
  requirement: !ruby/object:Gem::Requirement
@@ -45,6 +51,9 @@ dependencies:
45
51
  - - ">="
46
52
  - !ruby/object:Gem::Version
47
53
  version: 4.2.8
54
+ - - "<"
55
+ - !ruby/object:Gem::Version
56
+ version: '7.0'
48
57
  type: :runtime
49
58
  prerelease: false
50
59
  version_requirements: !ruby/object:Gem::Requirement
@@ -52,6 +61,9 @@ dependencies:
52
61
  - - ">="
53
62
  - !ruby/object:Gem::Version
54
63
  version: 4.2.8
64
+ - - "<"
65
+ - !ruby/object:Gem::Version
66
+ version: '7.0'
55
67
  - !ruby/object:Gem::Dependency
56
68
  name: builder
57
69
  requirement: !ruby/object:Gem::Requirement
@@ -100,28 +112,28 @@ dependencies:
100
112
  requirements:
101
113
  - - "~>"
102
114
  - !ruby/object:Gem::Version
103
- version: 0.10.4
115
+ version: '0.14'
104
116
  type: :development
105
117
  prerelease: false
106
118
  version_requirements: !ruby/object:Gem::Requirement
107
119
  requirements:
108
120
  - - "~>"
109
121
  - !ruby/object:Gem::Version
110
- version: 0.10.4
122
+ version: '0.14'
111
123
  - !ruby/object:Gem::Dependency
112
124
  name: minitest
113
125
  requirement: !ruby/object:Gem::Requirement
114
126
  requirements:
115
127
  - - "~>"
116
128
  - !ruby/object:Gem::Version
117
- version: '5.0'
129
+ version: '5.12'
118
130
  type: :development
119
131
  prerelease: false
120
132
  version_requirements: !ruby/object:Gem::Requirement
121
133
  requirements:
122
134
  - - "~>"
123
135
  - !ruby/object:Gem::Version
124
- version: '5.0'
136
+ version: '5.12'
125
137
  - !ruby/object:Gem::Dependency
126
138
  name: minitest-reporters
127
139
  requirement: !ruby/object:Gem::Requirement
@@ -186,14 +198,17 @@ extensions: []
186
198
  extra_rdoc_files: []
187
199
  files:
188
200
  - ".env.sample"
201
+ - ".github/workflows/main.yml"
189
202
  - ".gitignore"
190
- - ".travis.yml"
203
+ - ".vscode/settings.json"
191
204
  - Gemfile
192
205
  - LICENSE
193
206
  - README.md
194
207
  - Rakefile
195
208
  - lib/yahoo_store_api.rb
196
209
  - lib/yahoo_store_api/helper.rb
210
+ - lib/yahoo_store_api/image.rb
211
+ - lib/yahoo_store_api/image/upload_item_image_pack.rb
197
212
  - lib/yahoo_store_api/item.rb
198
213
  - lib/yahoo_store_api/item/delete_item.rb
199
214
  - lib/yahoo_store_api/item/edit_item.rb
@@ -209,7 +224,7 @@ files:
209
224
  homepage: https://github.com/t4traw/yahoo_store_api
210
225
  licenses: []
211
226
  metadata: {}
212
- post_install_message:
227
+ post_install_message:
213
228
  rdoc_options: []
214
229
  require_paths:
215
230
  - lib
@@ -224,8 +239,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
224
239
  - !ruby/object:Gem::Version
225
240
  version: '0'
226
241
  requirements: []
227
- rubygems_version: 3.1.6
228
- signing_key:
242
+ rubygems_version: 3.2.3
243
+ signing_key:
229
244
  specification_version: 4
230
245
  summary: Yahoo!ショッピング プロフェッショナル出店ストア向けAPIを簡単に叩けるrubyラッパー
231
246
  test_files: []
data/.travis.yml DELETED
@@ -1,13 +0,0 @@
1
- sudo: false
2
- language: ruby
3
- rvm:
4
- - 2.7.2
5
- - 2.6.6
6
- - 2.5.8
7
- - ruby-head
8
-
9
- matrix:
10
- allow_failures:
11
- - rvm: ruby-head
12
-
13
- before_install: gem install bundler -v 2.2.11