ebisu-rb 0.1.1 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/ebisu.gemspec +1 -1
- data/lib/ebisu.rb +14 -12
- data/lib/ebisu/apis.rb +2 -0
- data/lib/ebisu/apis/category_search.rb +3 -1
- data/lib/ebisu/apis/item_search.rb +25 -22
- data/lib/ebisu/client.rb +1 -3
- data/lib/ebisu/faraday/connection.rb +5 -2
- data/lib/ebisu/models/brands.rb +7 -7
- data/lib/ebisu/models/category.rb +4 -3
- data/lib/ebisu/models/category_id_path.rb +4 -3
- data/lib/ebisu/models/ex_image.rb +5 -4
- data/lib/ebisu/models/image.rb +8 -7
- data/lib/ebisu/models/item.rb +31 -40
- data/lib/ebisu/models/item_search_response.rb +2 -20
- data/lib/ebisu/models/payment.rb +2 -1
- data/lib/ebisu/models/payment_method.rb +2 -1
- data/lib/ebisu/models/point.rb +4 -11
- data/lib/ebisu/models/price.rb +2 -0
- data/lib/ebisu/models/price_label.rb +8 -9
- data/lib/ebisu/models/review.rb +2 -1
- data/lib/ebisu/models/shipping.rb +4 -3
- data/lib/ebisu/models/store.rb +14 -6
- data/lib/ebisu/models/store_image.rb +2 -1
- data/lib/ebisu/models/store_ratings.rb +4 -3
- data/lib/ebisu/version.rb +3 -1
- metadata +10 -10
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5f46b04483bf3756a33dbd2be54e8c581cc270333b78d130d4aaf0cc13beeff1
|
4
|
+
data.tar.gz: 753bbfa6b7d3aeadf529ac34a7735d611e831fda0f2c47213b1ccc9a1822d70f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7432a083e370ff8e4737575d84a2ebea500741d9afe16d85a8602f165db27ea280aa26406e5472648ff8e26778ffca348c61fb5645dcb252e8b364a83c2b49b3
|
7
|
+
data.tar.gz: 50675cbc6d2ecd1ba825a8862f27a9fd6744f7f4ab77eb33b25264f4802a624f7c79f87ede6c2b273980ddef27819598ea5214d782c11d1edb893171f4b6e7c7
|
data/ebisu.gemspec
CHANGED
@@ -24,7 +24,7 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.add_dependency "multi_xml"
|
25
25
|
spec.add_dependency 'nokogiri'
|
26
26
|
spec.add_dependency 'mysql2'
|
27
|
-
spec.add_development_dependency "bundler"
|
27
|
+
spec.add_development_dependency "bundler"
|
28
28
|
spec.add_development_dependency "rake", "~> 10.0"
|
29
29
|
spec.add_development_dependency "pry"
|
30
30
|
end
|
data/lib/ebisu.rb
CHANGED
@@ -1,15 +1,17 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
7
|
-
require
|
8
|
-
require
|
9
|
-
require
|
10
|
-
require
|
11
|
-
require
|
12
|
-
require
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'ebisu/version'
|
4
|
+
require 'logger'
|
5
|
+
require 'nokogiri'
|
6
|
+
require 'multi_xml'
|
7
|
+
require 'faraday'
|
8
|
+
require 'faraday_middleware'
|
9
|
+
require 'ebisu/faraday/request'
|
10
|
+
require 'ebisu/faraday/connection'
|
11
|
+
require 'ebisu/apis/category_search'
|
12
|
+
require 'ebisu/apis/item_search'
|
13
|
+
require 'ebisu/apis'
|
14
|
+
require 'ebisu/client'
|
13
15
|
|
14
16
|
module Ebisu
|
15
17
|
class Error < StandardError; end
|
data/lib/ebisu/apis.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'ebisu/models/category_search_response'
|
2
4
|
module Ebisu
|
3
5
|
module Apis
|
@@ -10,7 +12,7 @@ module Ebisu
|
|
10
12
|
# @option options [String] :callback JSONPの場合のコールバック
|
11
13
|
def category_search(category_id, options = {})
|
12
14
|
options.merge!(category_id: category_id)
|
13
|
-
Ebisu::CategorySearchResponse.new get('categorySearch', options)
|
15
|
+
Ebisu::CategorySearchResponse.new get('V1/categorySearch', options)
|
14
16
|
end
|
15
17
|
end
|
16
18
|
end
|
@@ -1,25 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'ebisu/models/item_search_response'
|
2
4
|
module Ebisu
|
3
5
|
module Apis
|
4
6
|
module ItemSearch
|
5
7
|
# @param [Hash] options
|
8
|
+
# @option options [String] :affiliate_type バリューコマースアフィリエイト(vc)
|
9
|
+
# @option options [String] :affiliate_id バリューコマースアフィリエイトのID
|
6
10
|
# @option options [String] :query
|
7
|
-
# @option options [
|
8
|
-
# @option options [
|
9
|
-
# @option options [
|
11
|
+
# @option options [Integer] :jan_code JANコード
|
12
|
+
# @option options [Integer] :isbn ISBNコード
|
13
|
+
# @option options [Integer] :image_size 画像サイズ. 76, 106, 132, 146, 300, 600
|
14
|
+
# @option options [Integer] :genre_category_id カテゴリID.カンマ区切りで複数指定
|
10
15
|
# @option options [String] :brand_id
|
11
|
-
# @option options [String] :
|
16
|
+
# @option options [String] :seller_id
|
12
17
|
# @option options [Integer] :price_from
|
13
18
|
# @option options [Integer] :price_to
|
14
|
-
# @option options [Float] :
|
15
|
-
# @option options [Float] :
|
16
|
-
# @option options [
|
19
|
+
# @option options [Float] :affiliate_rate_from
|
20
|
+
# @option options [Float] :affiliate_rate_to
|
21
|
+
# @option options [Boolean] :preorder
|
17
22
|
# @option options [Integer] :hits
|
18
|
-
# @option options [Integer] :
|
23
|
+
# @option options [Integer] :start
|
19
24
|
# @option options [String] :module priceranges/subcategories
|
20
|
-
# @option options [
|
21
|
-
# @option options [
|
22
|
-
# @option options [
|
25
|
+
# @option options [Boolean] :in_stock
|
26
|
+
# @option options [Boolean] :is_discounted
|
27
|
+
# @option options [String] :shipping (free/conditional_free)
|
23
28
|
# @option options [String] :payment
|
24
29
|
# ウォレット対応カード:yahoowallet
|
25
30
|
# クレジットカード:creditcard
|
@@ -30,22 +35,20 @@ module Ebisu
|
|
30
35
|
# ペイジー:payeasy
|
31
36
|
# Yahoo!マネー/預金払い:yahoomoney
|
32
37
|
# コンビニ:convenience
|
33
|
-
# @option options [String] :
|
34
|
-
# @option options [
|
35
|
-
# @option options [
|
36
|
-
# @option options [
|
37
|
-
# @option options [
|
38
|
-
# @option options [String] :
|
38
|
+
# @option options [String] :user_rank diamond/platinum/gold/silver/bronze/guest
|
39
|
+
# @option options [Integer] :sale_end_from
|
40
|
+
# @option options [Integer] :sale_end_to
|
41
|
+
# @option options [Integer] :sale_start_from
|
42
|
+
# @option options [Integer] :sale_start_to
|
43
|
+
# @option options [String] :delivery_area
|
44
|
+
# @option options [Integer] :delivery_day
|
45
|
+
# @option options [Integer] :delivery_deadline
|
39
46
|
# @option options [String] :sort (商品価格:price/ストア名:name/おすすめ順:score(デフォルト)/ レビュー数順:review_count)
|
40
47
|
# @option options [String] :condition (all/new/used)
|
41
|
-
# @option options [String] :output 出力形式 ( xml, php, jsonp )
|
42
|
-
# @option options [String] :affiliate_type バリューコマースアフィリエイト(vc)
|
43
|
-
# @option options [String] :affiliate_id バリューコマースアフィリエイトのID
|
44
|
-
# @option options [String] :callback JSONPの場合のコールバック
|
45
48
|
#
|
46
49
|
# @return [Ebisu::ItemSearchResponse]
|
47
50
|
def item_search(options = {})
|
48
|
-
Ebisu::ItemSearchResponse.new(get('itemSearch', options))
|
51
|
+
Ebisu::ItemSearchResponse.new(get('V3/itemSearch', options))
|
49
52
|
end
|
50
53
|
end
|
51
54
|
end
|
data/lib/ebisu/client.rb
CHANGED
@@ -5,7 +5,6 @@ module Ebisu
|
|
5
5
|
extend self
|
6
6
|
|
7
7
|
ATTRIBUTES = %i[
|
8
|
-
api_version
|
9
8
|
user_agent
|
10
9
|
endpoint
|
11
10
|
appid
|
@@ -20,8 +19,7 @@ module Ebisu
|
|
20
19
|
end
|
21
20
|
|
22
21
|
def reset
|
23
|
-
self.
|
24
|
-
self.endpoint = "https://shopping.yahooapis.jp/ShoppingWebService/#{api_version}/"
|
22
|
+
self.endpoint = 'https://shopping.yahooapis.jp/ShoppingWebService/'
|
25
23
|
self.user_agent = "YahooShopping Ruby Client/#{Ebisu::VERSION}"
|
26
24
|
self.appid = nil
|
27
25
|
self.proxy = nil
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Ebisu
|
2
4
|
module Faraday
|
3
5
|
module Connection
|
@@ -5,7 +7,7 @@ module Ebisu
|
|
5
7
|
|
6
8
|
def connection
|
7
9
|
options = {
|
8
|
-
|
10
|
+
headers: { 'Accept' => 'application/xml,application/json' }
|
9
11
|
}
|
10
12
|
|
11
13
|
options[:headers]['User-Agent'] = user_agent if user_agent
|
@@ -19,7 +21,8 @@ module Ebisu
|
|
19
21
|
::Faraday::Connection.new(endpoint, options) do |connection|
|
20
22
|
connection.use ::Faraday::Request::UrlEncoded
|
21
23
|
connection.use ::Faraday::Response::RaiseError
|
22
|
-
connection.
|
24
|
+
connection.response :xml, content_type: /\bxml$/
|
25
|
+
connection.response :json, content_type: /\bjson$/
|
23
26
|
require 'logger'
|
24
27
|
connection.response :logger, logger if logger
|
25
28
|
connection.adapter ::Faraday.default_adapter
|
data/lib/ebisu/models/brands.rb
CHANGED
@@ -1,17 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Ebisu
|
2
4
|
class Brands
|
3
5
|
# @!attribute name
|
4
6
|
# @return [String]
|
5
7
|
attr_reader :name
|
6
8
|
|
7
|
-
# @!attribute
|
8
|
-
# @return [
|
9
|
-
attr_reader :
|
9
|
+
# @!attribute id
|
10
|
+
# @return [Integer]
|
11
|
+
attr_reader :id
|
10
12
|
def initialize(brands)
|
11
|
-
@
|
12
|
-
@
|
13
|
+
@id = brands.dig('id')
|
14
|
+
@name = brands.dig('name')
|
13
15
|
end
|
14
16
|
end
|
15
17
|
end
|
16
|
-
|
17
|
-
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Ebisu
|
2
4
|
class YCategory
|
3
5
|
IDAndName = Struct.new(:id, :name)
|
@@ -7,8 +9,8 @@ module Ebisu
|
|
7
9
|
attr_reader :current
|
8
10
|
def initialize(category)
|
9
11
|
@current = IDAndName.new(
|
10
|
-
|
11
|
-
|
12
|
+
category.dig('id'),
|
13
|
+
category.dig('name')
|
12
14
|
)
|
13
15
|
end
|
14
16
|
end
|
@@ -33,4 +35,3 @@ module Ebisu
|
|
33
35
|
end
|
34
36
|
end
|
35
37
|
end
|
36
|
-
|
@@ -1,13 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Ebisu
|
2
4
|
class CategoryIdPath
|
3
5
|
# @!attribute path
|
4
6
|
# @return [Array[String]]
|
5
7
|
attr_reader :path
|
6
8
|
def initialize(data)
|
7
|
-
|
8
|
-
@path = case category
|
9
|
+
@path = case data
|
9
10
|
when Array
|
10
|
-
|
11
|
+
data.map { |x| x['id'] }
|
11
12
|
else
|
12
13
|
[]
|
13
14
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Ebisu
|
2
4
|
class ExImage
|
3
5
|
# @!attribute url
|
@@ -15,10 +17,9 @@ module Ebisu
|
|
15
17
|
def initialize(image)
|
16
18
|
return unless image
|
17
19
|
|
18
|
-
@url = image.dig('
|
19
|
-
@width = image.dig('
|
20
|
-
@height = image.dig('
|
20
|
+
@url = image.dig('url')
|
21
|
+
@width = image.dig('width')
|
22
|
+
@height = image.dig('height')
|
21
23
|
end
|
22
24
|
end
|
23
25
|
end
|
24
|
-
|
data/lib/ebisu/models/image.rb
CHANGED
@@ -1,22 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Ebisu
|
2
4
|
class Image
|
3
5
|
# @!attribute id
|
4
6
|
# @return [String]
|
5
7
|
attr_reader :id
|
6
|
-
|
8
|
+
|
7
9
|
# @!attribute small
|
8
10
|
# @return [String]
|
9
11
|
attr_reader :small
|
10
|
-
|
12
|
+
|
11
13
|
# @!attribute medium
|
12
14
|
# @return [String]
|
13
15
|
attr_reader :medium
|
14
16
|
|
15
|
-
def initialize(data)
|
16
|
-
@id =
|
17
|
-
@small = data[
|
18
|
-
@medium = data[
|
17
|
+
def initialize(id, data)
|
18
|
+
@id = id
|
19
|
+
@small = data['small']
|
20
|
+
@medium = data['medium']
|
19
21
|
end
|
20
22
|
end
|
21
23
|
end
|
22
|
-
|
data/lib/ebisu/models/item.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Ebisu
|
2
4
|
class Item
|
3
5
|
# @!attribute name
|
@@ -24,14 +26,6 @@ module Ebisu
|
|
24
26
|
# @return [String]
|
25
27
|
attr_reader :code
|
26
28
|
|
27
|
-
# @!attribute person_id
|
28
|
-
# @return [String]
|
29
|
-
attr_reader :person_id
|
30
|
-
|
31
|
-
# @!attribute product_id
|
32
|
-
# @return [String]
|
33
|
-
attr_reader :product_id
|
34
|
-
|
35
29
|
# @!attribute image
|
36
30
|
# @return [Ebisu::Image]
|
37
31
|
attr_reader :image
|
@@ -92,16 +86,13 @@ module Ebisu
|
|
92
86
|
# @return [Ebisu::Store]
|
93
87
|
attr_reader :store
|
94
88
|
|
89
|
+
# @!attribute affiliate_rate
|
90
|
+
# @return [Float]
|
91
|
+
attr_reader :affiliate_rate
|
92
|
+
|
95
93
|
class Availability
|
96
|
-
def initialize(
|
97
|
-
|
98
|
-
when 'instock'
|
99
|
-
@available = true
|
100
|
-
when 'outofstock'
|
101
|
-
@available = false
|
102
|
-
else
|
103
|
-
@available = false
|
104
|
-
end
|
94
|
+
def initialize(in_stock)
|
95
|
+
@available = in_stock
|
105
96
|
end
|
106
97
|
|
107
98
|
# @return [True|False]
|
@@ -110,30 +101,30 @@ module Ebisu
|
|
110
101
|
end
|
111
102
|
end
|
112
103
|
|
104
|
+
# @param [Hash] hit
|
113
105
|
def initialize(hit)
|
114
|
-
@name = hit.dig('
|
115
|
-
@description = hit.dig('
|
116
|
-
@headline = hit.dig('
|
117
|
-
@url = hit.dig('
|
118
|
-
@availability = Availability.new(hit.dig('
|
119
|
-
@code = hit.dig('
|
120
|
-
@
|
121
|
-
@
|
122
|
-
@
|
123
|
-
@
|
124
|
-
@
|
125
|
-
@
|
126
|
-
@
|
127
|
-
@
|
128
|
-
@
|
129
|
-
@
|
130
|
-
@
|
131
|
-
@
|
132
|
-
@
|
133
|
-
@
|
134
|
-
@
|
135
|
-
@
|
136
|
-
@store = Ebisu::Store.new(hit.dig('Store'))
|
106
|
+
@name = hit.dig('name')
|
107
|
+
@description = hit.dig('description')
|
108
|
+
@headline = hit.dig('headLine')
|
109
|
+
@url = hit.dig('url')
|
110
|
+
@availability = Availability.new(hit.dig('inStock'))
|
111
|
+
@code = hit.dig('code')
|
112
|
+
@price = Ebisu::Price.new(hit.dig('price'))
|
113
|
+
@price_label = Ebisu::PriceLabel.new(hit.dig('priceLabel'))
|
114
|
+
@jan_code = hit.dig('janCode')
|
115
|
+
@model = hit.dig('model')
|
116
|
+
@isbn_code = hit.dig('isbnCode')
|
117
|
+
@release_date = hit.dig('releaseDate')
|
118
|
+
@image = Ebisu::Image.new(hit.dig('imageId'), hit.dig('image'))
|
119
|
+
@ex_image = Ebisu::ExImage.new(hit.dig('exImage')) if hit.dig('exImage')
|
120
|
+
@review = Ebisu::Review.new(hit.dig('review'))
|
121
|
+
@affiliate_rate = hit.dig('affiliateRate')
|
122
|
+
@point = Ebisu::Point.new(hit.dig('point'))
|
123
|
+
@shipping = Ebisu::Shipping.new(hit.dig('shipping'))
|
124
|
+
@category = Ebisu::YCategory.new(hit.dig('genreCategory'))
|
125
|
+
@category_id_path = Ebisu::CategoryIdPath.new(hit.dig('parentGenreCategories'))
|
126
|
+
@brands = Ebisu::Brands.new(hit.dig('brand'))
|
127
|
+
@store = Ebisu::Store.new(hit.dig('seller'))
|
137
128
|
end
|
138
129
|
end
|
139
130
|
end
|
@@ -29,7 +29,7 @@ module Ebisu
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def result_set
|
32
|
-
@original_response
|
32
|
+
@original_response
|
33
33
|
end
|
34
34
|
|
35
35
|
# @return [Integer] 検索総HIT数
|
@@ -49,25 +49,7 @@ module Ebisu
|
|
49
49
|
|
50
50
|
# @return [Array<Ebisu::Item>] 検索結果のアイテムのリスト
|
51
51
|
def hits
|
52
|
-
|
53
|
-
case result_hit
|
54
|
-
when Array
|
55
|
-
result_hit.map{|hit| Ebisu::Item.new(hit)}
|
56
|
-
when Hash
|
57
|
-
# 結果がないとき
|
58
|
-
if result_hit['index'].to_i == 0
|
59
|
-
[].map{|hit| Ebisu::Item.new(hit)}
|
60
|
-
|
61
|
-
# 結果が1件だけのとき
|
62
|
-
else
|
63
|
-
[result_hit].map{|hit| Ebisu::Item.new(hit)}
|
64
|
-
end
|
65
|
-
when NilClass
|
66
|
-
[].map{|hit| Ebisu::Item.new(hit)}
|
67
|
-
end
|
52
|
+
(result_set['hits'] || []).map { |hit| Ebisu::Item.new(hit) }
|
68
53
|
end
|
69
|
-
|
70
54
|
end
|
71
|
-
|
72
55
|
end
|
73
|
-
|
data/lib/ebisu/models/payment.rb
CHANGED
data/lib/ebisu/models/point.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Ebisu
|
2
4
|
class Point
|
3
5
|
# @!attribute amount
|
@@ -6,19 +8,10 @@ module Ebisu
|
|
6
8
|
# @!attribute times
|
7
9
|
# @return [Integer]
|
8
10
|
attr_reader :times
|
9
|
-
# @!attribute premium_amount
|
10
|
-
# @return [Integer]
|
11
|
-
attr_reader :premium_amount
|
12
|
-
# @!attribute premium_times
|
13
|
-
# @return [Integer]
|
14
|
-
attr_reader :premium_times
|
15
11
|
|
16
12
|
def initialize(point)
|
17
|
-
@amount = point.dig('
|
18
|
-
@times = point.dig('
|
19
|
-
@premium_amount = point.dig('PremiumAmount').to_i
|
20
|
-
@premium_times = point.dig('PremiumTimes').to_i
|
13
|
+
@amount = point.dig('amount').to_i
|
14
|
+
@times = point.dig('times').to_i
|
21
15
|
end
|
22
16
|
end
|
23
|
-
|
24
17
|
end
|
data/lib/ebisu/models/price.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Ebisu
|
2
4
|
class PriceLabel
|
3
5
|
# @!attribute is_inclusive
|
@@ -33,15 +35,12 @@ module Ebisu
|
|
33
35
|
attr_reader :period_end
|
34
36
|
|
35
37
|
def initialize(price_label)
|
36
|
-
@is_inclusive = price_label['
|
37
|
-
@fixed_price = price_label['
|
38
|
-
@default_price = price_label['
|
39
|
-
@sale_price = price_label['
|
40
|
-
@
|
41
|
-
@
|
42
|
-
@period_start = price_label['PeriodStart']
|
43
|
-
@period_end = price_label['PeriodEnd']
|
38
|
+
@is_inclusive = price_label['taxable']
|
39
|
+
@fixed_price = price_label['fixedPrice']
|
40
|
+
@default_price = price_label['defaultPrice']
|
41
|
+
@sale_price = price_label['salePrice']
|
42
|
+
@period_start = price_label['periodStart']
|
43
|
+
@period_end = price_label['periodEnd']
|
44
44
|
end
|
45
45
|
end
|
46
46
|
end
|
47
|
-
|
data/lib/ebisu/models/review.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Ebisu
|
2
4
|
class Shipping
|
3
5
|
# @!attribute code
|
@@ -9,9 +11,8 @@ module Ebisu
|
|
9
11
|
attr_reader :name
|
10
12
|
|
11
13
|
def initialize(shipping)
|
12
|
-
@code = shipping.dig('
|
13
|
-
@name = shipping.dig('
|
14
|
+
@code = shipping.dig('code')
|
15
|
+
@name = shipping.dig('name')
|
14
16
|
end
|
15
17
|
end
|
16
18
|
end
|
17
|
-
|
data/lib/ebisu/models/store.rb
CHANGED
@@ -16,16 +16,24 @@ module Ebisu
|
|
16
16
|
# @return [True|False]
|
17
17
|
attr_reader :is_best_store
|
18
18
|
|
19
|
+
# @!attribute ratings
|
20
|
+
# @return [Ebisu::StoreRatings]
|
21
|
+
attr_reader :ratings
|
22
|
+
|
23
|
+
# @!attribute image_id
|
24
|
+
# @return [String]
|
25
|
+
attr_reader :image_id
|
26
|
+
|
19
27
|
# @!attribute ratings
|
20
28
|
# @return [Ebisu::StoreRatings]
|
21
29
|
attr_reader :ratings
|
22
30
|
def initialize(data)
|
23
|
-
@id = data.dig('
|
24
|
-
@name = data.dig('
|
25
|
-
@payment = Ebisu::Payment.new(data.dig('
|
26
|
-
@is_best_store = data.dig('
|
27
|
-
@ratings = Ebisu::StoreRatings.new(data.dig('
|
28
|
-
@
|
31
|
+
@id = data.dig('sellerId')
|
32
|
+
@name = data.dig('name')
|
33
|
+
@payment = Ebisu::Payment.new(data.dig('payment'))
|
34
|
+
@is_best_store = data.dig('isBestSeller')
|
35
|
+
@ratings = Ebisu::StoreRatings.new(data.dig('review'))
|
36
|
+
@image_id = data.dig('imageId')
|
29
37
|
end
|
30
38
|
end
|
31
39
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module Ebisu
|
2
4
|
class StoreRatings
|
3
5
|
# @!attribute rate
|
@@ -8,9 +10,8 @@ module Ebisu
|
|
8
10
|
# @return [Integer]
|
9
11
|
attr_reader :count
|
10
12
|
def initialize(data)
|
11
|
-
@rate = data.dig('
|
12
|
-
@count = data.dig('
|
13
|
+
@rate = data.dig('rate').to_f
|
14
|
+
@count = data.dig('reviewCount').to_i
|
13
15
|
end
|
14
16
|
end
|
15
17
|
end
|
16
|
-
|
data/lib/ebisu/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ebisu-rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- totem3
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-07-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -84,16 +84,16 @@ dependencies:
|
|
84
84
|
name: bundler
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- - "
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
89
|
+
version: '0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- - "
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '
|
96
|
+
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: rake
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -162,10 +162,10 @@ files:
|
|
162
162
|
- lib/ebisu/models/store_image.rb
|
163
163
|
- lib/ebisu/models/store_ratings.rb
|
164
164
|
- lib/ebisu/version.rb
|
165
|
-
homepage:
|
165
|
+
homepage:
|
166
166
|
licenses: []
|
167
167
|
metadata: {}
|
168
|
-
post_install_message:
|
168
|
+
post_install_message:
|
169
169
|
rdoc_options: []
|
170
170
|
require_paths:
|
171
171
|
- lib
|
@@ -181,7 +181,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
181
181
|
version: '0'
|
182
182
|
requirements: []
|
183
183
|
rubygems_version: 3.0.3
|
184
|
-
signing_key:
|
184
|
+
signing_key:
|
185
185
|
specification_version: 4
|
186
186
|
summary: yahoo api client
|
187
187
|
test_files: []
|