tcocca-etsy4r 0.3.1 → 0.3.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.
- data/Rakefile +9 -0
- data/VERSION.yml +1 -1
- data/etsy4r.gemspec +35 -0
- data/lib/etsy4r/category_commands.rb +14 -0
- data/lib/etsy4r/feedback_commands.rb +25 -0
- data/lib/etsy4r/listing_commands.rb +52 -0
- data/lib/etsy4r/shop_commands.rb +26 -0
- data/spec/etsy4r/category_commands_spec.rb +49 -0
- data/spec/etsy4r/feedback_commands_spec.rb +91 -0
- data/spec/etsy4r/listing_commands_spec.rb +204 -0
- data/spec/etsy4r/shop_commands_spec.rb +98 -0
- metadata +10 -1
data/Rakefile
CHANGED
|
@@ -14,26 +14,35 @@ begin
|
|
|
14
14
|
"LICENSE",
|
|
15
15
|
"Rakefile",
|
|
16
16
|
"VERSION.yml",
|
|
17
|
+
"etsy4r.gemspec",
|
|
17
18
|
"lib/etsy4r.rb",
|
|
19
|
+
"lib/etsy4r/category_commands.rb",
|
|
18
20
|
"lib/etsy4r/client.rb",
|
|
19
21
|
"lib/etsy4r/commands.rb",
|
|
20
22
|
"lib/etsy4r/favorite_commands.rb",
|
|
23
|
+
"lib/etsy4r/feedback_commands.rb",
|
|
21
24
|
"lib/etsy4r/gift_guide_commands.rb",
|
|
22
25
|
"lib/etsy4r/image_parser.rb",
|
|
26
|
+
"lib/etsy4r/listing_commands.rb",
|
|
23
27
|
"lib/etsy4r/response.rb",
|
|
24
28
|
"lib/etsy4r/server_commands.rb",
|
|
29
|
+
"lib/etsy4r/shop_commands.rb",
|
|
25
30
|
"lib/etsy4r/tag_commands.rb",
|
|
26
31
|
"lib/etsy4r/user_commands.rb",
|
|
27
32
|
"spec/rcov.opts",
|
|
28
33
|
"spec/spec.opts",
|
|
29
34
|
"spec/spec_helper.rb",
|
|
30
35
|
"spec/fixtures/images.html",
|
|
36
|
+
"spec/etsy4r/category_commands_spec.rb",
|
|
31
37
|
"spec/etsy4r/client_spec.rb",
|
|
32
38
|
"spec/etsy4r/commands_spec.rb",
|
|
33
39
|
"spec/etsy4r/favorite_commands_spec.rb",
|
|
40
|
+
"spec/etsy4r/feedback_commands_spec.rb",
|
|
34
41
|
"spec/etsy4r/gift_guide_commands_spec.rb",
|
|
35
42
|
"spec/etsy4r/image_parser_spec.rb",
|
|
43
|
+
"spec/etsy4r/listing_commands_spec.rb",
|
|
36
44
|
"spec/etsy4r/server_commands_spec.rb",
|
|
45
|
+
"spec/etsy4r/shop_commands_spec.rb",
|
|
37
46
|
"spec/etsy4r/tag_commands_spec.rb",
|
|
38
47
|
"spec/etsy4r/user_commands_spec.rb",
|
|
39
48
|
"tasks/rspec.rake",
|
data/VERSION.yml
CHANGED
data/etsy4r.gemspec
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
|
2
|
+
|
|
3
|
+
Gem::Specification.new do |s|
|
|
4
|
+
s.name = %q{etsy4r}
|
|
5
|
+
s.version = "0.3.2"
|
|
6
|
+
|
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
|
8
|
+
s.authors = ["Tom Cocca"]
|
|
9
|
+
s.date = %q{2009-04-17}
|
|
10
|
+
s.description = %q{Handcrafted API Wrapper for Etsy utilizing httparty}
|
|
11
|
+
s.email = %q{tom.cocca@gmail.com}
|
|
12
|
+
s.files = ["README", "LICENSE", "Rakefile", "VERSION.yml", "etsy4r.gemspec", "lib/etsy4r.rb", "lib/etsy4r/category_commands.rb", "lib/etsy4r/client.rb", "lib/etsy4r/commands.rb", "lib/etsy4r/favorite_commands.rb", "lib/etsy4r/feedback_commands.rb", "lib/etsy4r/gift_guide_commands.rb", "lib/etsy4r/image_parser.rb", "lib/etsy4r/listing_commands.rb", "lib/etsy4r/response.rb", "lib/etsy4r/server_commands.rb", "lib/etsy4r/shop_commands.rb", "lib/etsy4r/tag_commands.rb", "lib/etsy4r/user_commands.rb", "spec/rcov.opts", "spec/spec.opts", "spec/spec_helper.rb", "spec/fixtures/images.html", "spec/etsy4r/category_commands_spec.rb", "spec/etsy4r/client_spec.rb", "spec/etsy4r/commands_spec.rb", "spec/etsy4r/favorite_commands_spec.rb", "spec/etsy4r/feedback_commands_spec.rb", "spec/etsy4r/gift_guide_commands_spec.rb", "spec/etsy4r/image_parser_spec.rb", "spec/etsy4r/listing_commands_spec.rb", "spec/etsy4r/server_commands_spec.rb", "spec/etsy4r/shop_commands_spec.rb", "spec/etsy4r/tag_commands_spec.rb", "spec/etsy4r/user_commands_spec.rb", "tasks/rspec.rake", "examples/etsy.rb"]
|
|
13
|
+
s.has_rdoc = true
|
|
14
|
+
s.homepage = %q{http://github.com/tcocca/etsy4r}
|
|
15
|
+
s.rdoc_options = ["--inline-source", "--charset=UTF-8"]
|
|
16
|
+
s.require_paths = ["lib"]
|
|
17
|
+
s.rubygems_version = %q{1.3.1}
|
|
18
|
+
s.summary = %q{Handcrafted API Wrapper}
|
|
19
|
+
|
|
20
|
+
if s.respond_to? :specification_version then
|
|
21
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
|
22
|
+
s.specification_version = 2
|
|
23
|
+
|
|
24
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
|
25
|
+
s.add_runtime_dependency(%q<httparty>, [">= 0"])
|
|
26
|
+
s.add_runtime_dependency(%q<hpricot>, [">= 0"])
|
|
27
|
+
else
|
|
28
|
+
s.add_dependency(%q<httparty>, [">= 0"])
|
|
29
|
+
s.add_dependency(%q<hpricot>, [">= 0"])
|
|
30
|
+
end
|
|
31
|
+
else
|
|
32
|
+
s.add_dependency(%q<httparty>, [">= 0"])
|
|
33
|
+
s.add_dependency(%q<hpricot>, [">= 0"])
|
|
34
|
+
end
|
|
35
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
module Etsy4r
|
|
2
|
+
class CategoryCommands < Etsy4r::Commands
|
|
3
|
+
|
|
4
|
+
def get_top_categories
|
|
5
|
+
@client.process("/categories")
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def get_child_categories(category)
|
|
9
|
+
cat_param = category.gsub(/\s|\-/, "_")
|
|
10
|
+
@client.process("/categories/#{cat_param}/children")
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
module Etsy4r
|
|
2
|
+
class FeedbackCommands < Etsy4r::Commands
|
|
3
|
+
|
|
4
|
+
def get_feedback(feedback_id)
|
|
5
|
+
@client.process("/feedback/#{feedback_id}")
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def get_feedback_for_user(user_id, optional_params = {})
|
|
9
|
+
@client.process("/users/#{user_id}/feedback", optional_params)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def get_feedback_as_buyer(user_id, optional_params = {})
|
|
13
|
+
@client.process("/users/#{user_id}/feedback/buyer", optional_params)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def get_feedback_for_others(user_id, optional_params = {})
|
|
17
|
+
@client.process("/users/#{user_id}/feedback/others", optional_params)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def get_feedback_as_seller(user_id, optional_params = {})
|
|
21
|
+
@client.process("/users/#{user_id}/feedback/seller", optional_params)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
end
|
|
25
|
+
end
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
module Etsy4r
|
|
2
|
+
class ListingCommands < Etsy4r::Commands
|
|
3
|
+
|
|
4
|
+
def get_listing_details(listing_id, optional_params = {})
|
|
5
|
+
@client.process("/listings/#{listing_id}", optional_params)
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def get_listings_by_tags(tags, optional_params = {})
|
|
9
|
+
tag_params = tags.collect{|t| t.gsub(" ", "_")}
|
|
10
|
+
tag_param = tag_params.join(';')
|
|
11
|
+
@client.process("/listings/tags/#{tag_param}", optional_params)
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def get_listings_by_keywords(keywords, optional_params = {})
|
|
15
|
+
keyword_params = keywords.collect{|k| k.gsub(" ", "_")}
|
|
16
|
+
keyword_param = keyword_params.join(';')
|
|
17
|
+
@client.process("/listings/keywords/#{keyword_param}", optional_params)
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
def get_front_featured_listings(optional_params = {})
|
|
21
|
+
@client.process("/listings/featured/front", optional_params)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def get_all_listings(optional_params = {})
|
|
25
|
+
@client.process("/listings/all", optional_params)
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def get_listings_by_category(category, optional_params = {})
|
|
29
|
+
cat_param = category.gsub(/\s|\-/, "_")
|
|
30
|
+
@client.process("/listings/category/#{cat_param}", optional_params)
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def get_listings_by_color(color, optional_params = {})
|
|
34
|
+
color_param = color.gsub("#", "")
|
|
35
|
+
@client.process("/listings/color/#{color_param}", optional_params)
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
def get_listings_by_color_and_keywords(color, keywords, optional_params = {})
|
|
39
|
+
color_param = color.gsub("#", "")
|
|
40
|
+
keyword_params = keywords.collect{|k| k.gsub(" ", "_")}
|
|
41
|
+
search_terms = keyword_params.join(';')
|
|
42
|
+
@client.process("/listings/color/#{color_param}/keywords/#{search_terms}", optional_params)
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def get_listings_by_materials(materials, optional_params = {})
|
|
46
|
+
material_params = materials.collect{|t| t.gsub(" ", "_")}
|
|
47
|
+
material_param = material_params.join(';')
|
|
48
|
+
@client.process("/listings/materials/#{material_param}", optional_params)
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
end
|
|
52
|
+
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
module Etsy4r
|
|
2
|
+
class ShopCommands < Etsy4r::Commands
|
|
3
|
+
|
|
4
|
+
def get_shop_details(user_id, optional_params = {})
|
|
5
|
+
@client.process("/shops/#{user_id}", optional_params)
|
|
6
|
+
end
|
|
7
|
+
|
|
8
|
+
def get_featured_sellers(optional_params = {})
|
|
9
|
+
@client.process("/shops/featured", optional_params)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
def get_shop_listings(user_id, optional_params = {})
|
|
13
|
+
@client.process("/shops/#{user_id}/listings", optional_params)
|
|
14
|
+
end
|
|
15
|
+
|
|
16
|
+
def get_shops_by_name(search_name, optional_params = {})
|
|
17
|
+
search_name_param = search_name.gsub(" ", "_")
|
|
18
|
+
@client.process("/shops/keywords/#{search_name_param}", optional_params)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def get_featured_details(user_id, optional_params = {})
|
|
22
|
+
@client.process("/shops/#{user_id}/listings/featured", optional_params)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
end
|
|
26
|
+
end
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
require File.dirname(__FILE__) + '/../spec_helper'
|
|
2
|
+
require File.dirname(__FILE__) + '/../../lib/etsy4r'
|
|
3
|
+
|
|
4
|
+
describe Etsy4r::CategoryCommands do
|
|
5
|
+
include Etsy4rSpecHelper
|
|
6
|
+
|
|
7
|
+
before do
|
|
8
|
+
@client = etsy4r_client
|
|
9
|
+
@category_commands = Etsy4r::CategoryCommands.new(@client)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
describe 'initialize' do
|
|
13
|
+
it 'set the client' do
|
|
14
|
+
@category_commands.client.class.should == Etsy4r::Client
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
describe 'get_top_categories' do
|
|
19
|
+
it 'should return the top level tags' do
|
|
20
|
+
@res = @category_commands.get_top_categories
|
|
21
|
+
@res.should be_success
|
|
22
|
+
@res.results.should_not be_nil
|
|
23
|
+
@res.error_message.should be_blank
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
describe 'get_child_categories' do
|
|
28
|
+
it 'should return child tags when given a formatted tag' do
|
|
29
|
+
@res = @category_commands.get_child_categories('bags_and_purses')
|
|
30
|
+
@res.should be_success
|
|
31
|
+
@res.results.should_not be_nil
|
|
32
|
+
@res.error_message.should be_blank
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
it 'should return child tags when given a tag with spaces' do
|
|
36
|
+
@res = @category_commands.get_child_categories('bags and purses')
|
|
37
|
+
@res.should be_success
|
|
38
|
+
@res.results.should_not be_nil
|
|
39
|
+
@res.error_message.should be_blank
|
|
40
|
+
end
|
|
41
|
+
it 'should return child tags when given a tag with dashes' do
|
|
42
|
+
@res = @category_commands.get_child_categories('bags-and-purses')
|
|
43
|
+
@res.should be_success
|
|
44
|
+
@res.results.should_not be_nil
|
|
45
|
+
@res.error_message.should be_blank
|
|
46
|
+
end
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
end
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
require File.dirname(__FILE__) + '/../spec_helper'
|
|
2
|
+
require File.dirname(__FILE__) + '/../../lib/etsy4r'
|
|
3
|
+
|
|
4
|
+
describe Etsy4r::FeedbackCommands do
|
|
5
|
+
include Etsy4rSpecHelper
|
|
6
|
+
|
|
7
|
+
before do
|
|
8
|
+
@client = etsy4r_client
|
|
9
|
+
@feedback_commands = Etsy4r::FeedbackCommands.new(@client)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
describe 'initialize' do
|
|
13
|
+
it 'set the client' do
|
|
14
|
+
@feedback_commands.client.class.should == Etsy4r::Client
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
describe 'get_feedback' do
|
|
19
|
+
it 'should return feedback details' do
|
|
20
|
+
@res = @feedback_commands.get_feedback(17331973)
|
|
21
|
+
@res.should be_success
|
|
22
|
+
@res.results.should_not be_nil
|
|
23
|
+
@res.error_message.should be_blank
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
describe 'get_feedback_for_user' do
|
|
28
|
+
it 'should return feedback for a user when given a user_id' do
|
|
29
|
+
@res = @feedback_commands.get_feedback_for_user(5565464)
|
|
30
|
+
@res.should be_success
|
|
31
|
+
@res.results.should_not be_nil
|
|
32
|
+
@res.error_message.should be_blank
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
it 'should return feedback for a user when given a user_name' do
|
|
36
|
+
@res = @feedback_commands.get_feedback_for_user('maymaydesigns')
|
|
37
|
+
@res.should be_success
|
|
38
|
+
@res.results.should_not be_nil
|
|
39
|
+
@res.error_message.should be_blank
|
|
40
|
+
end
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
describe 'get_feedback_as_buyer' do
|
|
44
|
+
it 'should return feedback a user gave as a buyer when given a user_id' do
|
|
45
|
+
@res = @feedback_commands.get_feedback_as_buyer(5565464)
|
|
46
|
+
@res.should be_success
|
|
47
|
+
@res.results.should_not be_nil
|
|
48
|
+
@res.error_message.should be_blank
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
it 'should return feedback a user gave as a buyer when given a user_name' do
|
|
52
|
+
@res = @feedback_commands.get_feedback_as_buyer('maymaydesigns')
|
|
53
|
+
@res.should be_success
|
|
54
|
+
@res.results.should_not be_nil
|
|
55
|
+
@res.error_message.should be_blank
|
|
56
|
+
end
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
describe 'get_feedback_for_others' do
|
|
60
|
+
it 'should return feedback a user left when given a user_id' do
|
|
61
|
+
@res = @feedback_commands.get_feedback_for_others(5565464)
|
|
62
|
+
@res.should be_success
|
|
63
|
+
@res.results.should_not be_nil
|
|
64
|
+
@res.error_message.should be_blank
|
|
65
|
+
end
|
|
66
|
+
|
|
67
|
+
it 'should return feedback a user left when given a user_name' do
|
|
68
|
+
@res = @feedback_commands.get_feedback_for_others('maymaydesigns')
|
|
69
|
+
@res.should be_success
|
|
70
|
+
@res.results.should_not be_nil
|
|
71
|
+
@res.error_message.should be_blank
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
describe 'get_feedback_as_seller' do
|
|
76
|
+
it 'should return feedback when user was seller when given a user_id' do
|
|
77
|
+
@res = @feedback_commands.get_feedback_as_seller(5565464)
|
|
78
|
+
@res.should be_success
|
|
79
|
+
@res.results.should_not be_nil
|
|
80
|
+
@res.error_message.should be_blank
|
|
81
|
+
end
|
|
82
|
+
|
|
83
|
+
it 'should return feedback when user was seller when given a user_name' do
|
|
84
|
+
@res = @feedback_commands.get_feedback_as_seller('maymaydesigns')
|
|
85
|
+
@res.should be_success
|
|
86
|
+
@res.results.should_not be_nil
|
|
87
|
+
@res.error_message.should be_blank
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
|
|
91
|
+
end
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
require File.dirname(__FILE__) + '/../spec_helper'
|
|
2
|
+
require File.dirname(__FILE__) + '/../../lib/etsy4r'
|
|
3
|
+
|
|
4
|
+
describe Etsy4r::ListingCommands do
|
|
5
|
+
include Etsy4rSpecHelper
|
|
6
|
+
|
|
7
|
+
before do
|
|
8
|
+
@client = etsy4r_client
|
|
9
|
+
@listing_commands = Etsy4r::ListingCommands.new(@client)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
describe 'initialize' do
|
|
13
|
+
it 'set the client' do
|
|
14
|
+
@listing_commands.client.class.should == Etsy4r::Client
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
describe 'get_listing_details' do
|
|
19
|
+
it 'should return details' do
|
|
20
|
+
@res = @listing_commands.get_listing_details(19749826)
|
|
21
|
+
@res.should be_success
|
|
22
|
+
@res.results.should_not be_nil
|
|
23
|
+
@res.error_message.should be_blank
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
it 'should take the detail_level optional param' do
|
|
27
|
+
@res = @listing_commands.get_listing_details(19749826, :detail_level => 'high')
|
|
28
|
+
@res.should be_success
|
|
29
|
+
@res.results.should_not be_nil
|
|
30
|
+
@res.error_message.should be_blank
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
describe 'get_listings_by_tags' do
|
|
35
|
+
it 'should take an array of tags' do
|
|
36
|
+
@res = @listing_commands.get_listings_by_tags(['bags_and_purses', 'art', 'shoulder bag'])
|
|
37
|
+
@res.should be_success
|
|
38
|
+
@res.results.should_not be_nil
|
|
39
|
+
@res.error_message.should be_blank
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
it 'should take the optional params sort_on and sort_order' do
|
|
43
|
+
@res = @listing_commands.get_listings_by_tags(['bags_and_purses', 'art', 'shoulder bag'], :sort_on => 'price', :sort_order => 'down')
|
|
44
|
+
@res.should be_success
|
|
45
|
+
@res.results.should_not be_nil
|
|
46
|
+
@res.error_message.should be_blank
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
describe 'get_listings_by_keywords' do
|
|
51
|
+
it 'should take an array of keywords' do
|
|
52
|
+
@res = @listing_commands.get_listings_by_keywords(['bags_and_purses', 'art', 'shoulder bag'])
|
|
53
|
+
@res.should be_success
|
|
54
|
+
@res.results.should_not be_nil
|
|
55
|
+
@res.error_message.should be_blank
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
it 'should take the optional params sort_on and sort_order' do
|
|
59
|
+
@res = @listing_commands.get_listings_by_keywords(['bags_and_purses', 'art', 'shoulder bag'], :sort_on => 'price', :sort_order => 'down')
|
|
60
|
+
@res.should be_success
|
|
61
|
+
@res.results.should_not be_nil
|
|
62
|
+
@res.error_message.should be_blank
|
|
63
|
+
end
|
|
64
|
+
|
|
65
|
+
it 'should take the optional params min_price and max_prce' do
|
|
66
|
+
@res = @listing_commands.get_listings_by_keywords(['bags_and_purses', 'art', 'shoulder bag'], :min_price => 0, :max_price => 22.99)
|
|
67
|
+
@res.should be_success
|
|
68
|
+
@res.results.should_not be_nil
|
|
69
|
+
@res.error_message.should be_blank
|
|
70
|
+
end
|
|
71
|
+
end
|
|
72
|
+
|
|
73
|
+
describe 'get_front_featured_listings' do
|
|
74
|
+
it 'should return the listings' do
|
|
75
|
+
@res = @listing_commands.get_front_featured_listings
|
|
76
|
+
@res.should be_success
|
|
77
|
+
@res.results.should_not be_nil
|
|
78
|
+
@res.error_message.should be_blank
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
it 'should take optional params' do
|
|
82
|
+
@res = @listing_commands.get_front_featured_listings(:detail_level => 'medium', :limit => 45, :offset => 45)
|
|
83
|
+
@res.should be_success
|
|
84
|
+
@res.results.should_not be_nil
|
|
85
|
+
@res.error_message.should be_blank
|
|
86
|
+
end
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
describe 'get_all_listings' do
|
|
90
|
+
it 'should return listings' do
|
|
91
|
+
@res = @listing_commands.get_all_listings
|
|
92
|
+
@res.should be_success
|
|
93
|
+
@res.results.should_not be_nil
|
|
94
|
+
@res.error_message.should be_blank
|
|
95
|
+
end
|
|
96
|
+
|
|
97
|
+
it 'should take optional params' do
|
|
98
|
+
@res = @listing_commands.get_all_listings(:detail_level => 'medium', :limit => 45, :offset => 45, :sort_on => 'ending', :sort_order => 'down')
|
|
99
|
+
@res.should be_success
|
|
100
|
+
@res.results.should_not be_nil
|
|
101
|
+
@res.error_message.should be_blank
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
describe 'get_listings_by_category' do
|
|
106
|
+
it 'should return listings' do
|
|
107
|
+
@res = @listing_commands.get_listings_by_category('bags_and_purses')
|
|
108
|
+
@res.should be_success
|
|
109
|
+
@res.results.should_not be_nil
|
|
110
|
+
@res.error_message.should be_blank
|
|
111
|
+
end
|
|
112
|
+
|
|
113
|
+
it 'should return listings when given a category with spaces' do
|
|
114
|
+
@res = @listing_commands.get_listings_by_category('bags and purses')
|
|
115
|
+
@res.should be_success
|
|
116
|
+
@res.results.should_not be_nil
|
|
117
|
+
@res.error_message.should be_blank
|
|
118
|
+
end
|
|
119
|
+
|
|
120
|
+
it 'should take optional params' do
|
|
121
|
+
@res = @listing_commands.get_listings_by_category('bags and purses', :detail_level => 'medium', :limit => 45, :offset => 45, :sort_on => 'price', :sort_order => 'down')
|
|
122
|
+
@res.should be_success
|
|
123
|
+
@res.results.should_not be_nil
|
|
124
|
+
@res.error_message.should be_blank
|
|
125
|
+
end
|
|
126
|
+
end
|
|
127
|
+
|
|
128
|
+
describe 'get_listings_by_color' do
|
|
129
|
+
it 'should return listings when given 6 hex digits' do
|
|
130
|
+
@res = @listing_commands.get_listings_by_color('FFFFFF')
|
|
131
|
+
@res.should be_success
|
|
132
|
+
@res.results.should_not be_nil
|
|
133
|
+
@res.error_message.should be_blank
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
it 'should return listings when given 6 hex digits with a pound sign' do
|
|
137
|
+
@res = @listing_commands.get_listings_by_color('#FFFFFF')
|
|
138
|
+
@res.should be_success
|
|
139
|
+
@res.results.should_not be_nil
|
|
140
|
+
@res.error_message.should be_blank
|
|
141
|
+
end
|
|
142
|
+
|
|
143
|
+
it 'should return listings when given an HSV format' do
|
|
144
|
+
@res = @listing_commands.get_listings_by_color('360;100;100')
|
|
145
|
+
@res.should be_success
|
|
146
|
+
@res.results.should_not be_nil
|
|
147
|
+
@res.error_message.should be_blank
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
it 'should take optional params' do
|
|
151
|
+
@res = @listing_commands.get_listings_by_color('FFFFFF', :detail_level => 'medium', :limit => 45, :offset => 45, :wiggle => 10)
|
|
152
|
+
@res.should be_success
|
|
153
|
+
@res.results.should_not be_nil
|
|
154
|
+
@res.error_message.should be_blank
|
|
155
|
+
end
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
describe 'get_listings_by_materials' do
|
|
159
|
+
it 'should take an array of materials' do
|
|
160
|
+
@res = @listing_commands.get_listings_by_materials(['cotton', 'wool'])
|
|
161
|
+
@res.should be_success
|
|
162
|
+
@res.results.should_not be_nil
|
|
163
|
+
@res.error_message.should be_blank
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
it 'should take the optional params sort_on and sort_order' do
|
|
167
|
+
@res = @listing_commands.get_listings_by_materials(['cotton', 'wool'], :sort_on => 'price', :sort_order => 'down')
|
|
168
|
+
@res.should be_success
|
|
169
|
+
@res.results.should_not be_nil
|
|
170
|
+
@res.error_message.should be_blank
|
|
171
|
+
end
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
describe 'get_listings_by_color_and_keywords' do
|
|
175
|
+
it 'should return listings when a hex color and keywords' do
|
|
176
|
+
@res = @listing_commands.get_listings_by_color_and_keywords('FFFFFF', ['bags', 'bracelets'])
|
|
177
|
+
@res.should be_success
|
|
178
|
+
@res.results.should_not be_nil
|
|
179
|
+
@res.error_message.should be_blank
|
|
180
|
+
end
|
|
181
|
+
|
|
182
|
+
it 'should return listings when given a hex color with pound and keywords' do
|
|
183
|
+
@res = @listing_commands.get_listings_by_color_and_keywords('#FFFFFF', ['bags', 'bracelets'])
|
|
184
|
+
@res.should be_success
|
|
185
|
+
@res.results.should_not be_nil
|
|
186
|
+
@res.error_message.should be_blank
|
|
187
|
+
end
|
|
188
|
+
|
|
189
|
+
it 'should return listings when given an HSV color and keywords' do
|
|
190
|
+
@res = @listing_commands.get_listings_by_color_and_keywords('360;100;100', ['bags', 'bracelets'])
|
|
191
|
+
@res.should be_success
|
|
192
|
+
@res.results.should_not be_nil
|
|
193
|
+
@res.error_message.should be_blank
|
|
194
|
+
end
|
|
195
|
+
|
|
196
|
+
it 'should take optional params' do
|
|
197
|
+
@res = @listing_commands.get_listings_by_color_and_keywords('FFFFFF', ['bags', 'bracelets'], :detail_level => 'medium', :limit => 45, :offset => 45, :wiggle => 10)
|
|
198
|
+
@res.should be_success
|
|
199
|
+
@res.results.should_not be_nil
|
|
200
|
+
@res.error_message.should be_blank
|
|
201
|
+
end
|
|
202
|
+
end
|
|
203
|
+
|
|
204
|
+
end
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
require File.dirname(__FILE__) + '/../spec_helper'
|
|
2
|
+
require File.dirname(__FILE__) + '/../../lib/etsy4r'
|
|
3
|
+
|
|
4
|
+
describe Etsy4r::ShopCommands do
|
|
5
|
+
include Etsy4rSpecHelper
|
|
6
|
+
|
|
7
|
+
before do
|
|
8
|
+
@client = etsy4r_client
|
|
9
|
+
@shop_commands = Etsy4r::ShopCommands.new(@client)
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
describe 'initialize' do
|
|
13
|
+
it 'set the client' do
|
|
14
|
+
@shop_commands.client.class.should == Etsy4r::Client
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
describe 'get_shop_details' do
|
|
19
|
+
it 'should return details when given a user_id' do
|
|
20
|
+
@res = @shop_commands.get_shop_details(5565464)
|
|
21
|
+
@res.should be_success
|
|
22
|
+
@res.results.should_not be_nil
|
|
23
|
+
@res.error_message.should be_blank
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
it 'should return details when given a user_name' do
|
|
27
|
+
@res = @shop_commands.get_shop_details('maymaydesigns')
|
|
28
|
+
@res.should be_success
|
|
29
|
+
@res.results.should_not be_nil
|
|
30
|
+
@res.error_message.should be_blank
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
it 'should accept detail_level as an optional param' do
|
|
34
|
+
@res = @shop_commands.get_shop_details(5565464, :detail_level => 'high')
|
|
35
|
+
@res.should be_success
|
|
36
|
+
@res.results.should_not be_nil
|
|
37
|
+
@res.error_message.should be_blank
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
describe 'get_featured_sellers' do
|
|
42
|
+
it 'should return the list of featured sellers' do
|
|
43
|
+
@res = @shop_commands.get_featured_sellers
|
|
44
|
+
@res.should be_success
|
|
45
|
+
@res.results.should_not be_nil
|
|
46
|
+
@res.error_message.should be_blank
|
|
47
|
+
end
|
|
48
|
+
end
|
|
49
|
+
|
|
50
|
+
describe 'get_shop_listings' do
|
|
51
|
+
it 'should return listings when given a user_id' do
|
|
52
|
+
@res = @shop_commands.get_shop_listings(5565464)
|
|
53
|
+
@res.should be_success
|
|
54
|
+
@res.results.should_not be_nil
|
|
55
|
+
@res.error_message.should be_blank
|
|
56
|
+
end
|
|
57
|
+
|
|
58
|
+
it 'should return listings when given a user_name' do
|
|
59
|
+
@res = @shop_commands.get_shop_listings('maymaydesigns')
|
|
60
|
+
@res.should be_success
|
|
61
|
+
@res.results.should_not be_nil
|
|
62
|
+
@res.error_message.should be_blank
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
describe 'get_shops_by_name' do
|
|
67
|
+
it 'should return shops when given a search_name' do
|
|
68
|
+
@res = @shop_commands.get_shops_by_name('amanda')
|
|
69
|
+
@res.should be_success
|
|
70
|
+
@res.results.should_not be_nil
|
|
71
|
+
@res.error_message.should be_blank
|
|
72
|
+
end
|
|
73
|
+
|
|
74
|
+
it 'should return shops when given a search_name with spaces' do
|
|
75
|
+
@res = @shop_commands.get_shops_by_name('amanda t')
|
|
76
|
+
@res.should be_success
|
|
77
|
+
@res.results.should_not be_nil
|
|
78
|
+
@res.error_message.should be_blank
|
|
79
|
+
end
|
|
80
|
+
end
|
|
81
|
+
|
|
82
|
+
describe 'get_featured_details' do
|
|
83
|
+
it 'should return featured listings when given a user_id' do
|
|
84
|
+
@res = @shop_commands.get_featured_details(5565464)
|
|
85
|
+
@res.should be_success
|
|
86
|
+
@res.results.should_not be_nil
|
|
87
|
+
@res.error_message.should be_blank
|
|
88
|
+
end
|
|
89
|
+
|
|
90
|
+
it 'should return featured listings when given a user_name' do
|
|
91
|
+
@res = @shop_commands.get_featured_details('maymaydesigns')
|
|
92
|
+
@res.should be_success
|
|
93
|
+
@res.results.should_not be_nil
|
|
94
|
+
@res.error_message.should be_blank
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: tcocca-etsy4r
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.3.
|
|
4
|
+
version: 0.3.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Tom Cocca
|
|
@@ -45,26 +45,35 @@ files:
|
|
|
45
45
|
- LICENSE
|
|
46
46
|
- Rakefile
|
|
47
47
|
- VERSION.yml
|
|
48
|
+
- etsy4r.gemspec
|
|
48
49
|
- lib/etsy4r.rb
|
|
50
|
+
- lib/etsy4r/category_commands.rb
|
|
49
51
|
- lib/etsy4r/client.rb
|
|
50
52
|
- lib/etsy4r/commands.rb
|
|
51
53
|
- lib/etsy4r/favorite_commands.rb
|
|
54
|
+
- lib/etsy4r/feedback_commands.rb
|
|
52
55
|
- lib/etsy4r/gift_guide_commands.rb
|
|
53
56
|
- lib/etsy4r/image_parser.rb
|
|
57
|
+
- lib/etsy4r/listing_commands.rb
|
|
54
58
|
- lib/etsy4r/response.rb
|
|
55
59
|
- lib/etsy4r/server_commands.rb
|
|
60
|
+
- lib/etsy4r/shop_commands.rb
|
|
56
61
|
- lib/etsy4r/tag_commands.rb
|
|
57
62
|
- lib/etsy4r/user_commands.rb
|
|
58
63
|
- spec/rcov.opts
|
|
59
64
|
- spec/spec.opts
|
|
60
65
|
- spec/spec_helper.rb
|
|
61
66
|
- spec/fixtures/images.html
|
|
67
|
+
- spec/etsy4r/category_commands_spec.rb
|
|
62
68
|
- spec/etsy4r/client_spec.rb
|
|
63
69
|
- spec/etsy4r/commands_spec.rb
|
|
64
70
|
- spec/etsy4r/favorite_commands_spec.rb
|
|
71
|
+
- spec/etsy4r/feedback_commands_spec.rb
|
|
65
72
|
- spec/etsy4r/gift_guide_commands_spec.rb
|
|
66
73
|
- spec/etsy4r/image_parser_spec.rb
|
|
74
|
+
- spec/etsy4r/listing_commands_spec.rb
|
|
67
75
|
- spec/etsy4r/server_commands_spec.rb
|
|
76
|
+
- spec/etsy4r/shop_commands_spec.rb
|
|
68
77
|
- spec/etsy4r/tag_commands_spec.rb
|
|
69
78
|
- spec/etsy4r/user_commands_spec.rb
|
|
70
79
|
- tasks/rspec.rake
|