amazon_order 0.1.1 → 0.1.2

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: 52166bb75c3fe54c69163a6878e2b8a34a3d8590
4
- data.tar.gz: 35af75fbdcbec9a9de5bdf380b45bb97dcb513ee
3
+ metadata.gz: e865042b91b22077149316ff57d575168bc43635
4
+ data.tar.gz: ca3967e1120cbcee525fa691d22cd7c9744bba51
5
5
  SHA512:
6
- metadata.gz: 8e75e7d9b750bb9bdb970758c100271bc4910d9551ac273d7b8c267505607ac0187189e3f1db67d356464d6ed7c031dfb0b509260993352caa4481e4d5dfc849
7
- data.tar.gz: 9ba44f92e89e6e60a44da9a080f44f3d95601c22e3fc57d6c211d0b0fd0eee2766a5a90254e49c89866b51f936f103a0feb0178ac48607bc2c0801a9d5ebf0a1
6
+ metadata.gz: 99679b709cfe850447a320f941550f0e7d88c23b16b9d44fd43d6df7984f6c76d80275f2278906c24a38fd8fdaf173ddbfaf9ecdbcabf58c4131cf573b00faaa
7
+ data.tar.gz: 145c6fb0c6eb615b8d92e5c00f686cd7a8f6e869f209c821431504e6e9728edacbdbfe7d8fcfabed0163e379077717561884d804ff101268be208afb5fcfa41c
@@ -17,7 +17,7 @@ module AmazonOrder
17
17
  end
18
18
 
19
19
  def order_total
20
- @_order_total ||= @node.css('.order-info .a-col-left .a-column')[1].css('.value').text.strip.gsub(/[^\d\.]/,'').to_f
20
+ @_order_total ||= @node.css('.order-info .a-col-left .a-column')[1].css('.value').text.strip.gsub(/[^\d\.]/, '').to_f
21
21
  end
22
22
 
23
23
  def shipment_status
@@ -26,9 +26,15 @@ module AmazonOrder
26
26
  end
27
27
 
28
28
  def shipment_note
29
- @_shipment_note ||= @node.css('.shipment .shipment-top-row').present? ? @node.css('.shipment .shipment-top-row .a-row')[1].text.strip : nil
29
+ @_shipment_note ||= case order_type
30
+ when :item_order
31
+ @node.css('.shipment .shipment-top-row').present? ? @node.css('.shipment .shipment-top-row .a-row')[1].text.strip : nil
32
+ when :service_order
33
+ nil
34
+ end
30
35
  end
31
36
 
37
+
32
38
  def order_details_path
33
39
  @_order_details_path ||= @node.css('.order-info .a-col-right .a-row')[1].css('a.a-link-normal')[0].attr('href')
34
40
  end
@@ -38,7 +44,7 @@ module AmazonOrder
38
44
  end
39
45
 
40
46
  def products
41
- @_products ||= @node.css('.a-box.order-info ~ .a-box .a-col-left .a-row')[0].css('.a-fixed-left-grid').map{|e| AmazonOrder::Parsers::Product.new(e, fetched_at: fetched_at) }
47
+ @_products ||= @node.css('.a-box.order-info ~ .a-box .a-col-left .a-row')[0].css('.a-fixed-left-grid').map { |e| AmazonOrder::Parsers::Product.new(e, fetched_at: fetched_at) }
42
48
  end
43
49
 
44
50
 
@@ -47,6 +53,10 @@ module AmazonOrder
47
53
  hash.merge!(products: products.map(&:to_hash))
48
54
  end
49
55
  end
56
+
57
+ def order_type
58
+ @node.css('[id^=Leave-Service-Feedback]').present? ? :service_order : :item_order
59
+ end
50
60
  end
51
61
  end
52
62
  end
@@ -21,7 +21,7 @@ module AmazonOrder
21
21
  end
22
22
 
23
23
  def image_url
24
- @_image_url ||= get_original_image_url(@node.css('.a-col-left img')[0].attr('src'))
24
+ @_image_url ||= get_original_image_url(@node.css('.a-col-left img')[0].attr('data-a-hires'))
25
25
  end
26
26
  end
27
27
  end
@@ -1,3 +1,3 @@
1
1
  module AmazonOrder
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: amazon_order
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
  - Kazuho Yamaguchi
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-07-12 00:00:00.000000000 Z
11
+ date: 2018-01-30 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: amazon_auth
@@ -153,7 +153,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
153
153
  version: '0'
154
154
  requirements: []
155
155
  rubyforge_project:
156
- rubygems_version: 2.6.11
156
+ rubygems_version: 2.6.13
157
157
  signing_key:
158
158
  specification_version: 4
159
159
  summary: Scrape information of amazon orders