dpickett-ramazon_advertising 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/features/getting_offer_details.feature +18 -0
- data/features/step_definitions/product_steps.rb +12 -4
- data/lib/ramazon/merchant.rb +21 -0
- data/lib/ramazon/offer.rb +25 -0
- data/lib/ramazon/product.rb +3 -0
- data/lib/ramazon_advertising.rb +3 -0
- data/ramazon_advertising.gemspec +5 -2
- metadata +5 -2
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.3
|
@@ -0,0 +1,18 @@
|
|
1
|
+
Feature: Retrieving offer details
|
2
|
+
As a user of the Ramazon_advertising api
|
3
|
+
I want to get offer details
|
4
|
+
In order to get pricing information about a given product
|
5
|
+
|
6
|
+
Background:
|
7
|
+
Given I have a valid access key
|
8
|
+
And I have a valid secret key
|
9
|
+
|
10
|
+
Scenario: Getting offers on a DVD
|
11
|
+
Given I am searching with the "item_id" of "B000NTPDSW"
|
12
|
+
And I am searching with the "response_group" of "Medium,Offers"
|
13
|
+
When I perform the product search
|
14
|
+
Then I should get a product
|
15
|
+
And the product should have "offers"
|
16
|
+
And each of the product's "offers" should have a "price"
|
17
|
+
And each of the product's "offers" should have a "condition"
|
18
|
+
And each of the product's "offers" should have a "sub_condition"
|
@@ -1,11 +1,11 @@
|
|
1
1
|
When /^I try to find the asin "([^\"]*)"$/ do |asin|
|
2
|
-
@products = Ramazon::Product.find(:item_id => asin, :response_group => ["Medium", "BrowseNodes"])
|
2
|
+
@products = Ramazon::Product.find(:item_id => asin, :response_group => ["Medium", "BrowseNodes", "Offers"])
|
3
3
|
@product = @products[0]
|
4
4
|
end
|
5
5
|
|
6
6
|
Given /^I am searching with the "([^\"]*)" of "([^\"]*)"$/ do |attr, value|
|
7
7
|
@search_options ||= {}
|
8
|
-
@search_options[attr] = value
|
8
|
+
@search_options[attr.to_sym] = value
|
9
9
|
end
|
10
10
|
|
11
11
|
When /^I perform the product search$/ do
|
@@ -35,17 +35,25 @@ end
|
|
35
35
|
|
36
36
|
Then /^I should get a product$/ do
|
37
37
|
raise @error if @error
|
38
|
+
@product = @products[0] unless @product
|
38
39
|
@product.should_not be_nil
|
39
40
|
end
|
40
41
|
|
41
|
-
Then /^the product should have the
|
42
|
+
Then /^the product should have (the\s)?"([^\"]*)" "([^\"]*)"$/ do |the, attr, value|
|
42
43
|
@product.send(attr).should eql(value)
|
43
44
|
end
|
44
45
|
|
45
|
-
Then /^the product should have a
|
46
|
+
Then /^the product should have (a\s)?"([^\"]*)"$/ do |a, attr|
|
46
47
|
@product.send(attr).should_not be_nil
|
47
48
|
end
|
48
49
|
|
50
|
+
Then /^each of the product's "([^\"]*)" should have a "([^\"]*)"$/ do |collection_name, attr|
|
51
|
+
@product.send(collection_name).should_not be_empty
|
52
|
+
@product.send(collection_name).each do |i|
|
53
|
+
i.send(attr).should_not be_nil
|
54
|
+
end
|
55
|
+
end
|
56
|
+
|
49
57
|
Then /^the product should have a category tree for "([^\"]*)"$/ do |category_name|
|
50
58
|
@product.category_tree[category_name].should_not be_nil
|
51
59
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module Ramazon
|
2
|
+
# Merchant Details
|
3
|
+
# Current supports the following accessors
|
4
|
+
# +merchant_id+::
|
5
|
+
# The id of the merchant
|
6
|
+
# +glance_page_url+::
|
7
|
+
# The url of the merchant
|
8
|
+
# +average_feedback_rating+::
|
9
|
+
# Average Feedback Rating
|
10
|
+
# +total_feedback+::
|
11
|
+
# Total Feedback
|
12
|
+
class Merchant
|
13
|
+
include HappyMapper
|
14
|
+
tag "Merchant"
|
15
|
+
|
16
|
+
element :merchant_id, String, :tag => "MerchantId"
|
17
|
+
element :glance_page_url, String, :tag => "GlancePage"
|
18
|
+
element :average_feedback_rating, Float, :tag => "AverageFeedbackRating"
|
19
|
+
element :total_feedback, Integer, :tag => "TotalFeedback"
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Ramazon
|
2
|
+
# Offer Details
|
3
|
+
# Currently supports the following accessors
|
4
|
+
# +merchant+::
|
5
|
+
# The merchant that is listing this product (NOTE: Returns Ramazon::Merchant object)
|
6
|
+
# +condition+::
|
7
|
+
# The condition of the product
|
8
|
+
# +sub_condition+::
|
9
|
+
# The subcondition of the product
|
10
|
+
# +listing_id+::
|
11
|
+
# The id of the listing
|
12
|
+
# +price+::
|
13
|
+
# The asking price of the listing (NOTE: Returns Ramazon::Price object)
|
14
|
+
class Offer
|
15
|
+
include HappyMapper
|
16
|
+
tag "Offer"
|
17
|
+
|
18
|
+
has_one :merchant, Ramazon::Merchant, :tag => "Merchant"
|
19
|
+
element :condition, String, :tag => "OfferAttributes/Condition"
|
20
|
+
element :sub_condition, String, :tag => "OfferAttributes/SubCondition"
|
21
|
+
element :listing_id, String, :tag => "OfferListing/OfferListingId"
|
22
|
+
element :price, Ramazon::Price, :tag => "OfferListing/Price"
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
data/lib/ramazon/product.rb
CHANGED
@@ -40,6 +40,8 @@ module Ramazon
|
|
40
40
|
# The release date of the product
|
41
41
|
# +original_release_date+::
|
42
42
|
# The original release date of the product
|
43
|
+
# +offers+::
|
44
|
+
# The collection of offers available for the given product
|
43
45
|
# @example find an individual item
|
44
46
|
# @products = Ramazon::Product.find(:item_id => "B000NU2CY4", :response_group => "Medium")
|
45
47
|
# @products[0].title
|
@@ -68,6 +70,7 @@ module Ramazon
|
|
68
70
|
abstract_element :thumb_image, Ramazon::Image, :tag => "ThumbImage"
|
69
71
|
abstract_element :list_price, Ramazon::Price, :tag => "ItemAttributes/ListPrice"
|
70
72
|
abstract_element :lowest_new_price, Ramazon::Price, :tag => "OfferSummary/LowestNewPrice"
|
73
|
+
has_many :offers, Ramazon::Offer, :tag => "Offers/Offer"
|
71
74
|
|
72
75
|
element :sales_rank, Integer, :tag => "SalesRank"
|
73
76
|
|
data/lib/ramazon_advertising.rb
CHANGED
data/ramazon_advertising.gemspec
CHANGED
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
Gem::Specification.new do |s|
|
4
4
|
s.name = %q{ramazon_advertising}
|
5
|
-
s.version = "0.2.
|
5
|
+
s.version = "0.2.3"
|
6
6
|
|
7
7
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
8
|
s.authors = ["Dan Pickett"]
|
9
|
-
s.date = %q{2009-09-
|
9
|
+
s.date = %q{2009-09-10}
|
10
10
|
s.description = %q{TODO: longer description of your gem}
|
11
11
|
s.email = %q{dpickett@enlightsolutions.com}
|
12
12
|
s.extra_rdoc_files = [
|
@@ -22,6 +22,7 @@ Gem::Specification.new do |s|
|
|
22
22
|
"VERSION",
|
23
23
|
"features/friendly_errors.feature",
|
24
24
|
"features/generate_root_browse_nodes.feature",
|
25
|
+
"features/getting_offer_details.feature",
|
25
26
|
"features/retrieving_a_product.feature",
|
26
27
|
"features/searching_for_products.feature",
|
27
28
|
"features/step_definitions/auth_steps.rb",
|
@@ -36,6 +37,8 @@ Gem::Specification.new do |s|
|
|
36
37
|
"lib/ramazon/configuration.rb",
|
37
38
|
"lib/ramazon/error.rb",
|
38
39
|
"lib/ramazon/image.rb",
|
40
|
+
"lib/ramazon/merchant.rb",
|
41
|
+
"lib/ramazon/offer.rb",
|
39
42
|
"lib/ramazon/price.rb",
|
40
43
|
"lib/ramazon/product.rb",
|
41
44
|
"lib/ramazon/product_collection.rb",
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dpickett-ramazon_advertising
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dan Pickett
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-09-
|
12
|
+
date: 2009-09-10 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -90,6 +90,7 @@ files:
|
|
90
90
|
- VERSION
|
91
91
|
- features/friendly_errors.feature
|
92
92
|
- features/generate_root_browse_nodes.feature
|
93
|
+
- features/getting_offer_details.feature
|
93
94
|
- features/retrieving_a_product.feature
|
94
95
|
- features/searching_for_products.feature
|
95
96
|
- features/step_definitions/auth_steps.rb
|
@@ -104,6 +105,8 @@ files:
|
|
104
105
|
- lib/ramazon/configuration.rb
|
105
106
|
- lib/ramazon/error.rb
|
106
107
|
- lib/ramazon/image.rb
|
108
|
+
- lib/ramazon/merchant.rb
|
109
|
+
- lib/ramazon/offer.rb
|
107
110
|
- lib/ramazon/price.rb
|
108
111
|
- lib/ramazon/product.rb
|
109
112
|
- lib/ramazon/product_collection.rb
|