tipsanity_merchant_extractor 0.0.3 → 0.0.4.alpha
Sign up to get free protection for your applications and to get access to all the features.
- data/CHANGELOG.md +1 -1
- data/lib/tipsanity_merchant_extractor/version.rb +1 -1
- data/lib/tipsanity_merchant_extractor.rb +16 -6
- metadata +15 -15
data/CHANGELOG.md
CHANGED
@@ -1,8 +1,7 @@
|
|
1
1
|
require "tipsanity_merchant_extractor/version"
|
2
2
|
require 'uri'
|
3
|
-
# $LOAD_PATH << './lib'
|
4
3
|
|
5
|
-
require 'asin_configuration'
|
4
|
+
# require 'asin_configuration'
|
6
5
|
|
7
6
|
module TipsanityMerchantExtractor
|
8
7
|
module UrlFormatter
|
@@ -42,7 +41,8 @@ module TipsanityMerchantExtractor
|
|
42
41
|
:expiry_date,
|
43
42
|
:currency_code,
|
44
43
|
:image_url,
|
45
|
-
:details_url
|
44
|
+
:details_url,
|
45
|
+
:is_dp
|
46
46
|
|
47
47
|
def initialize merchant_url
|
48
48
|
@merchant_url = UrlFormatter.format_url merchant_url
|
@@ -53,7 +53,7 @@ module TipsanityMerchantExtractor
|
|
53
53
|
client = ASIN::Client.instance
|
54
54
|
product = client.lookup filtered_asin_from_amazon_path
|
55
55
|
@product_name = product.first.title
|
56
|
-
@description = product.first.review
|
56
|
+
filtered_asin_from_amazon_path{|is_dp| is_dp == false} ? @description = product.first.review : @description = product.first.raw.EditorialReviews.EditorialReview.first.Content
|
57
57
|
@list_price = product.first.amount.to_f/100 || product.first.raw.ItemAttributes.ListPrice.Amount.to_f/100
|
58
58
|
@currency_code = product.first.raw.ItemAttributes.ListPrice.CurrencyCode
|
59
59
|
@expiry_date = Date.today
|
@@ -93,9 +93,19 @@ module TipsanityMerchantExtractor
|
|
93
93
|
def filtered_asin_from_amazon_path
|
94
94
|
split_path = merchant_amazon_path.split('/')
|
95
95
|
if split_path.include? 'gp'
|
96
|
-
|
96
|
+
if block_given?
|
97
|
+
@is_dp = false
|
98
|
+
yield @is_dp
|
99
|
+
else
|
100
|
+
asin = split_path[split_path.index('gp')+2]
|
101
|
+
end
|
97
102
|
elsif split_path.include? 'dp'
|
98
|
-
|
103
|
+
if block_given?
|
104
|
+
@is_dp = true
|
105
|
+
yield @is_dp
|
106
|
+
else
|
107
|
+
asin = split_path[split_path.index('dp')+1]
|
108
|
+
end
|
99
109
|
else
|
100
110
|
"path does not have asin"
|
101
111
|
end
|
metadata
CHANGED
@@ -1,19 +1,19 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tipsanity_merchant_extractor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.0.4.alpha
|
5
|
+
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Umesh Umesh
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-07-
|
12
|
+
date: 2013-07-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: asin
|
16
|
-
requirement: &
|
16
|
+
requirement: &70152960 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *70152960
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: httpclient
|
27
|
-
requirement: &
|
27
|
+
requirement: &70152610 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *70152610
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rake
|
38
|
-
requirement: &
|
38
|
+
requirement: &70152300 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *70152300
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: rspec
|
49
|
-
requirement: &
|
49
|
+
requirement: &70151950 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: '0'
|
55
55
|
type: :development
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *70151950
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: httpclient
|
60
|
-
requirement: &
|
60
|
+
requirement: &70151580 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - ! '>='
|
@@ -65,7 +65,7 @@ dependencies:
|
|
65
65
|
version: '0'
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *70151580
|
69
69
|
description: Tipsanity website uses this gem to extract their marchant related information
|
70
70
|
email:
|
71
71
|
- umeshblader@gmail.com
|
@@ -101,9 +101,9 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
101
101
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
102
102
|
none: false
|
103
103
|
requirements:
|
104
|
-
- - ! '
|
104
|
+
- - ! '>'
|
105
105
|
- !ruby/object:Gem::Version
|
106
|
-
version:
|
106
|
+
version: 1.3.1
|
107
107
|
requirements: []
|
108
108
|
rubyforge_project:
|
109
109
|
rubygems_version: 1.8.15
|