shopee 0.1.1 → 0.1.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 22604eafa589c9f99893438843dc7310e33b0b73
4
- data.tar.gz: 4360c0bb56b354ef5a3d84cd2fab2ab29776be66
3
+ metadata.gz: 3aff6cf07785ae43aa42c1f7d802ed94a74a1f53
4
+ data.tar.gz: c9ac1da5895b9ed8d9e823b4f9a77bb6630aa83e
5
5
  SHA512:
6
- metadata.gz: 6af0698b3f83bdcc46085e144499e149e3374d6f7ba41c48e53efc1b807586c3e27482f7b13e577f79b1af3f6c809bdae2c22f92e620c713548043c2bfba1ed5
7
- data.tar.gz: 8a8e6d28e15a1ae251cbc251e092db01ea0e76bf31c0243a8ac948a395a970fc734309e5d4cbb20a6c2fd2a3bf74bfa73d423bb8e25214633186e9a1fb58f37d
6
+ metadata.gz: 902449372a269b53f95fadb46d434ada76547d44bf67242e2feb2b62482126bc9e176894fef5aa4314ad5054fc60c9aecac0189b368d9b07076dc8019d7aa63a
7
+ data.tar.gz: da698c2812a2dccb9f88f1c39df063c1a1db922e00077a23108bf6c11b0d610f6930034aab6d5787da20c529e96d8b704fcd87d6807d894ced913b97f4c5e8b6
data/bin/shopee CHANGED
@@ -38,7 +38,7 @@ Commander.configure do
38
38
  c.action do |args, options|
39
39
  shopeecate = ShopeeScrape::ShopeeListGoodsByCate.new(args[0])
40
40
  goods = shopeecate.goods
41
- puts shopeecate.search_keyword(goods, args[1])
41
+ puts shopeecate.search_keyword(goods, args[1], args[2])
42
42
  end
43
43
  end
44
44
 
@@ -20,8 +20,8 @@ module ShopeeScrape
20
20
  @goods ||= extract_goods
21
21
  end
22
22
 
23
- def search_keyword(good, keyword)
24
- @similar ||= find_similiar_goods(goods, keyword)
23
+ def search_keyword(good, keyword, list_num)
24
+ @similar ||= find_similiar_goods(goods, keyword, list_num)
25
25
  end
26
26
 
27
27
  private
@@ -70,7 +70,7 @@ module ShopeeScrape
70
70
  results
71
71
  end
72
72
 
73
- def find_similiar_goods(goods, keyword)
73
+ def find_similiar_goods(goods, keyword, list_num)
74
74
  jarow = FuzzyStringMatch::JaroWinkler.create( :native )
75
75
  rank = {}
76
76
  goods.each do |good|
@@ -82,7 +82,7 @@ module ShopeeScrape
82
82
  rank_after_sort = Hash[rank.sort_by{|k, v| v}.reverse]
83
83
  key = rank_after_sort.keys()
84
84
  results = []
85
- for i in 0..2
85
+ for i in 0..list_num.to_i - 1
86
86
  good_name = key[i]
87
87
  goods.each do |good|
88
88
  if good['name'] == good_name
@@ -1,4 +1,4 @@
1
1
  module ShopeeScrape
2
- VERSION = '0.1.1'
3
- DATE = '2015-11-22'
2
+ VERSION = '0.1.2'
3
+ DATE = '2015-12-06'
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shopee
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sheng Jung Wu
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2015-11-22 00:00:00.000000000 Z
14
+ date: 2015-12-06 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: minitest