amazon_seller_central 0.2.0 → 0.2.1
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.
- data/README.md +2 -2
- data/VERSION +1 -1
- data/amazon_seller_central.gemspec +2 -2
- data/lib/amazon_seller_central.rb +1 -1
- data/lib/amazon_seller_central/feedback_page.rb +7 -6
- data/lib/amazon_seller_central/inventory.rb +4 -3
- data/lib/amazon_seller_central/inventory_page.rb +3 -2
- data/lib/amazon_seller_central/mechanizer.rb +0 -2
- data/lib/amazon_seller_central/page.rb +3 -2
- data/spec/amazon_seller_central_spec.rb +1 -1
- data/spec/lib/feedback_page_spec.rb +0 -3
- data/spec/lib/inventory_page_spec.rb +1 -1
- data/spec/lib/mechanizer_spec.rb +1 -1
- metadata +4 -4
data/README.md
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# amazon\_seller\_central
|
2
2
|
|
3
|
-
This gem
|
4
|
-
|
3
|
+
This gem wraps Amazon's SellerCentral pages with a Ruby API.
|
4
|
+
Currently this gem supports accessing buyer feedback, accessing
|
5
5
|
current inventory listings, and simple updates to those listings.
|
6
6
|
|
7
7
|
## Setup
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.2.
|
1
|
+
0.2.1
|
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{amazon_seller_central}
|
8
|
-
s.version = "0.2.
|
8
|
+
s.version = "0.2.1"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["optoro"]
|
12
|
-
s.date = %q{2011-09-
|
12
|
+
s.date = %q{2011-09-08}
|
13
13
|
s.description = %q{This gem is intended to wrap Amazon's SellerCentral pages with a Ruby API. Currently this gem supports accessing buyer feedback only.}
|
14
14
|
s.email = %q{dev@optoro.com}
|
15
15
|
s.extra_rdoc_files = [
|
@@ -9,8 +9,8 @@ module AmazonSellerCentral
|
|
9
9
|
def next_page
|
10
10
|
@next_page ||= begin
|
11
11
|
raise NoNextPageAvailableError unless has_next?
|
12
|
-
page =
|
13
|
-
FeedbackPage.new(:page => page)
|
12
|
+
page = @agent.follow_link_with(:text => 'Next')
|
13
|
+
FeedbackPage.new(:page => page, :agent => @agent)
|
14
14
|
end
|
15
15
|
end
|
16
16
|
|
@@ -25,10 +25,11 @@ module AmazonSellerCentral
|
|
25
25
|
module ClassMethods
|
26
26
|
|
27
27
|
def load_first_page
|
28
|
-
AmazonSellerCentral.mechanizer
|
29
|
-
|
30
|
-
|
31
|
-
|
28
|
+
mech = AmazonSellerCentral.mechanizer
|
29
|
+
mech.login_to_seller_central
|
30
|
+
feedback_home = mech.follow_link_with(:text => "Feedback")
|
31
|
+
feedback_page = mech.follow_link_with(:text => "View all your feedback")
|
32
|
+
FeedbackPage.new(:page => feedback_page, :agent => mech)
|
32
33
|
end
|
33
34
|
|
34
35
|
def load_all_pages
|
@@ -2,9 +2,10 @@ module AmazonSellerCentral
|
|
2
2
|
class Inventory
|
3
3
|
module ClassMethods
|
4
4
|
def load_first_page
|
5
|
-
AmazonSellerCentral.mechanizer
|
6
|
-
|
7
|
-
|
5
|
+
mech = AmazonSellerCentral.mechanizer
|
6
|
+
mech.login_to_seller_central
|
7
|
+
manage_inventory = mech.follow_link_with(:text => "Manage Inventory")
|
8
|
+
InventoryPage.new( :page => manage_inventory, :page_no => 1, :uri_base => manage_inventory.uri.to_s, :agent => mech )
|
8
9
|
end
|
9
10
|
|
10
11
|
def load_all_pages
|
@@ -15,11 +15,12 @@ module AmazonSellerCentral
|
|
15
15
|
@next_page ||= begin
|
16
16
|
raise NoNextPageAvailableError unless has_next?
|
17
17
|
|
18
|
-
next_page =
|
18
|
+
next_page = @agent.agent.get("#{@uri_base}&searchPageOffset=#{@page_no + 1}")
|
19
19
|
InventoryPage.new(
|
20
20
|
:page => next_page,
|
21
21
|
:page_no => (@page_no + 1),
|
22
|
-
:uri_base => @uri_base
|
22
|
+
:uri_base => @uri_base,
|
23
|
+
:agent => @agent
|
23
24
|
)
|
24
25
|
end
|
25
26
|
end
|
@@ -3,8 +3,9 @@ module AmazonSellerCentral
|
|
3
3
|
attr_accessor :body
|
4
4
|
|
5
5
|
def initialize(options={})
|
6
|
-
@page
|
7
|
-
@
|
6
|
+
@page = options.delete(:page)
|
7
|
+
@agent = options.delete(:agent)
|
8
|
+
@body = @page ? @page.body : ""
|
8
9
|
end
|
9
10
|
|
10
11
|
def has_next?
|
@@ -26,7 +26,7 @@ describe "AmazonSellerCentral" do
|
|
26
26
|
AmazonSellerCentral.configuration.login_password.should == @password
|
27
27
|
end
|
28
28
|
|
29
|
-
it "allows access to a
|
29
|
+
it "allows access to a mechanizer" do
|
30
30
|
mech = AmazonSellerCentral.mechanizer
|
31
31
|
mech.should be_instance_of(AmazonSellerCentral::Mechanizer)
|
32
32
|
end
|
@@ -2,7 +2,6 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
|
2
2
|
|
3
3
|
describe "FeedbackPage" do
|
4
4
|
before :all do
|
5
|
-
#AmazonSellerCentral.mechanizer.reset!
|
6
5
|
@first_page_test_regex = FEEDBACK_FIRST_PAGE_TEST_REGEX
|
7
6
|
@second_page_test_regex = FEEDBACK_SECOND_PAGE_TEST_REGEX
|
8
7
|
@last_page_test_regex = FEEDBACK_LAST_PAGE_TEST_REGEX
|
@@ -22,14 +21,12 @@ describe "FeedbackPage" do
|
|
22
21
|
|
23
22
|
describe "ClassMethods" do
|
24
23
|
it "loads the first page of feedback data" do
|
25
|
-
AmazonSellerCentral.mechanizer.reset!
|
26
24
|
page = AmazonSellerCentral::FeedbackPage.load_first_page
|
27
25
|
page.should be_kind_of(AmazonSellerCentral::FeedbackPage)
|
28
26
|
page.body.should =~ @first_page_test_regex
|
29
27
|
end
|
30
28
|
|
31
29
|
it "loads all feedback pages" do
|
32
|
-
AmazonSellerCentral.mechanizer.reset!
|
33
30
|
pages = AmazonSellerCentral::FeedbackPage.load_all_pages
|
34
31
|
pages.size.should == 3
|
35
32
|
pages.first.body.should =~ @first_page_test_regex
|
@@ -87,7 +87,7 @@ describe "InventoryPage" do
|
|
87
87
|
|
88
88
|
@first_page.apply_listings(listings).should be_true
|
89
89
|
|
90
|
-
(
|
90
|
+
(@first_page.instance_variable_get('@agent').last_page.parser.css('div#msg_saveSuccess')[0]['style'] !~ /display: none/).should be_true
|
91
91
|
|
92
92
|
FakeWeb.register_uri(:get, 'https://sellercentral.amazon.com/gp/ezdpc-gui/inventory-status/status.html/ref=ag_invmgr_mmap_home', :response => mock_pages[:update_inventory_result_from_page_1])
|
93
93
|
listing = AmazonSellerCentral::Inventory.load_first_page.listings[0]
|
data/spec/lib/mechanizer_spec.rb
CHANGED
@@ -30,7 +30,7 @@ describe "Mechanizer" do
|
|
30
30
|
|
31
31
|
mech = AmazonSellerCentral.mechanizer
|
32
32
|
mech.login_to_seller_central
|
33
|
-
|
33
|
+
mech.reset!
|
34
34
|
lambda {
|
35
35
|
mech.follow_link_with(:text => "Feedback")
|
36
36
|
}.should raise_exception(AmazonSellerCentral::Mechanizer::AgentResetError)
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: amazon_seller_central
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 2
|
9
|
-
-
|
10
|
-
version: 0.2.
|
9
|
+
- 1
|
10
|
+
version: 0.2.1
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- optoro
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-09-
|
18
|
+
date: 2011-09-08 00:00:00 -04:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|