tcocca-etsy4r 0.1.0 → 0.2.0

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.
@@ -1,4 +1,4 @@
1
1
  ---
2
2
  :patch: 0
3
3
  :major: 0
4
- :minor: 1
4
+ :minor: 2
@@ -6,7 +6,8 @@ require 'yaml'
6
6
 
7
7
 
8
8
  # Initialize a new Etsy API Client
9
- client = Etsy4r::Client.new('your_api_key')
9
+ #client = Etsy4r::Client.new('your_api_key')
10
+ client = Etsy4r::Client.new('dacmw5zgq4x82z95ben5em6v')
10
11
 
11
12
 
12
13
  # Initialize a ServerCommands object
@@ -32,7 +33,6 @@ if res.success?
32
33
  puts res.body .to_yaml # Return the full body response of the call
33
34
  puts res.results.to_yaml # Return the results (the actual deta) in an array of hashes
34
35
  puts res.count # Count of all pieces of data that the Query returned (note: this is a total count not the count returned)
35
- puts res.limit # The max number of records returned in the API call
36
36
  puts res.type # The type of result passed back
37
37
  puts res.params # The params passed in to the query
38
38
  else
@@ -85,9 +85,13 @@ res = shop.get_featured_sellers
85
85
 
86
86
  # Returns all listings for a "shop" (or user)
87
87
  # Takes either a user_id or a user_name
88
- # Also takes :detail_level, :limit and :offset optional params
89
- res = shop.get_listings(5565464)
90
- res = shop.get_listings('maymaydesigns')
88
+ # Optional Params
89
+ # :detail_level, :limit, :offset,
90
+ # :sort_order enum(up, down)
91
+ # :sort_on enum(created, price)
92
+ # section_id int
93
+ res = shop.get_shop_listings(5565464)
94
+ res = shop.get_shop_listings('maymaydesigns')
91
95
 
92
96
  # Search for shops be a name
93
97
  # The name params is required
@@ -116,6 +120,19 @@ res = tag.get_child_tags('bags and purses')
116
120
  res = tag.get_child_tags('bags_and_purses')
117
121
 
118
122
 
123
+ # Initialize a CategoryCommands object
124
+ tag = Etsy4r::CategoryCommands.new(client)
125
+
126
+ # Returns the top level categories, no params
127
+ res = tag.get_top_categories
128
+
129
+ # Returns the child categories of a category
130
+ # Spaces and dashes get converted to underscores
131
+ res = tag.get_child_categories('bags-and-purses')
132
+ res = tag.get_child_categories('bags and purses')
133
+ res = tag.get_child_categories('bags_and_purses')
134
+
135
+
119
136
  # Initialiaze a ListingCommands object
120
137
  listing = Etsy4r::ListingCommands.new(client)
121
138
 
@@ -149,6 +166,41 @@ res = listing.get_listings_by_keywords(['bags and purses', 'art', 'shoulder bag'
149
166
  res = listing.get_front_featured_listings
150
167
  res = listing.get_front_featured_listings(:detail_level => 'medium', :limit => '45')
151
168
 
169
+ # Returns all listings
170
+ # No required params
171
+ # Optional params
172
+ # :detail_level, :limit, :offset, :sort_on, :sort_order
173
+ res = listing.get_all_listings
174
+ res = listing.get_all_listings(:detail_level => 'medium', :limit => 45, :offset => 45, :sort_on => 'ending', :sort_order => 'down')
175
+
176
+ # Returns all listings in a category
177
+ # category is required
178
+ # Optional params
179
+ # :detail_level, :limit, :offset, :sort_on, :sort_order
180
+ res = listing.get_listings_by_category('bags_and_purses')
181
+ res = listing.get_listings_by_category('bags_and_purses', :detail_level => 'medium', :limit => 15, :offset => 15, :sort_on => 'price', :sort_order => 'down')
182
+
183
+ # Returns all listings matching a color
184
+ # color is required
185
+ # HSV color as an array (0;0;0 through 360;100;100) or an RGB color in web notation (#000000 through #FFFFFF.)
186
+ # NOTE: The Etsy API uses HSV colors internally, and the conversion from RGB to HSV is not 100% accurate.
187
+ # (RGB colors are converted to HSV internally, which may result in small rounding errors. They may omit the leading "#", or use the three-digit form.)
188
+ # Optional params
189
+ # :wiggle default => 5, type => int
190
+ # :detail_level, :limit, :offset
191
+ res = listing.get_listings_by_color('FFFFFF')
192
+ res = listing.get_listings_by_color('#FFFFFF')
193
+ res = listing.get_listings_by_color('360;100;100', :detail_level => 'medium', :limit => 15, :offset => 15, :wiggle => 10)
194
+
195
+ # Returns all listings matching a color and search terms
196
+ # color is required (HSV or RGB)
197
+ # an array of search terms is required
198
+ # Optional params
199
+ # :detail_level, :limit, :offset, :wiggle
200
+ res = listing.get_listings_by_color_and_keywords('FFFFFF', ['bags', 'bracelets'])
201
+ res = listing.get_listings_by_color_and_keywords('#FFFFFF', ['bags', 'bracelets'])
202
+ res = listing.get_listings_by_color_and_keywords('360;100;100', ['bags', 'bracelets'], :detail_level => 'medium', :wiggle => 10)
203
+
152
204
 
153
205
  # Initialize a FavoriteCommands object
154
206
  favorite = Etsy4r::FavoriteCommands.new(client)
@@ -157,8 +209,8 @@ favorite = Etsy4r::FavoriteCommands.new(client)
157
209
  # Takes either a user_id or user_name
158
210
  # Optional params
159
211
  # :detail_level, :limit, :offset
160
- res = favorite.get_favorers_of_user(5565464)
161
- res = favorite.get_favorers_of_user(5565464, :detail_level => 'high', :limit => 5, :offset => 5)
212
+ res = favorite.get_favorers_of_shop(5565464)
213
+ res = favorite.get_favorers_of_shop(5565464, :detail_level => 'high', :limit => 5, :offset => 5)
162
214
 
163
215
  # Returns the users who favorited the listing passed in
164
216
  # Takes a listing_id
@@ -182,6 +234,41 @@ res = favorite.get_favorite_listings_of_user(5565464)
182
234
  res = favorite.get_favorite_listings_of_user(5565464, :detail_level => 'high', :limit => 5, :offset => 5)
183
235
 
184
236
 
237
+ # Initialize a FeedbackCommands object
238
+ feedback = Etsy4r::FeedbackCommands.new(client)
239
+
240
+ # Returns the top level tags, no params
241
+ res = feedback.get_feedback(17331973)
242
+
243
+ # Returns all feedback for a user
244
+ # Takes either a user_id or user_name
245
+ # Optional params
246
+ # :limit, :offset
247
+ res = feedback.get_feedback_for_user(5565464)
248
+ res = feedback.get_feedback_for_user('maymaydesigns')
249
+
250
+ # Returns all feedback where the user was the buyer
251
+ # Takes either a user_id or user_name
252
+ # Optional params
253
+ # :limit, :offset
254
+ res = feedback.get_feedback_as_buyer(5565464)
255
+ res = feedback.get_feedback_as_buyer('maymaydesigns')
256
+
257
+ # Returns all feedback where the user left feedback
258
+ # Takes either a user_id or user_name
259
+ # Optional params
260
+ # :limit, :offset
261
+ res = feedback.get_feedback_for_others(5565464)
262
+ res = feedback.get_feedback_for_others('maymaydesigns')
263
+
264
+ # Returns all feedback where the user was the seller
265
+ # Takes either a user_id or user_name
266
+ # Optional params
267
+ # :limit, :offset
268
+ res = feedback.get_feedback_as_seller(5565464)
269
+ res = feedback.get_feedback_as_seller('maymaydesigns')
270
+
271
+
185
272
  # Initialize an ImageParser object
186
273
  # This takes a single parameter which is the id of an Etsy listing
187
274
  image_parser = Etsy4r::ImageParser.new(19781773)
@@ -11,4 +11,6 @@ require File.dirname(__FILE__) + '/etsy4r/shop_commands'
11
11
  require File.dirname(__FILE__) + '/etsy4r/listing_commands'
12
12
  require File.dirname(__FILE__) + '/etsy4r/tag_commands'
13
13
  require File.dirname(__FILE__) + '/etsy4r/favorite_commands'
14
+ require File.dirname(__FILE__) + '/etsy4r/category_commands'
15
+ require File.dirname(__FILE__) + '/etsy4r/feedback_commands'
14
16
  require File.dirname(__FILE__) + '/etsy4r/image_parser'
@@ -2,7 +2,13 @@ module Etsy4r
2
2
  class FavoriteCommands < Etsy4r::Commands
3
3
 
4
4
  def get_favorers_of_user(user_id, optional_params = {})
5
- @client.process("/users/#{user_id}/favorers", optional_params)
5
+ warn "[DEPRECATION] get_favorers_of_user is deprecated. " <<
6
+ "Use get_favorers_of_shop instead."
7
+ get_favorers_of_shop(user_id, optional_params = {})
8
+ end
9
+
10
+ def get_favorers_of_shop(user_id, optional_params = {})
11
+ @client.process("/shops/#{user_id}/favorers", optional_params)
6
12
  end
7
13
 
8
14
  def get_favorers_of_listing(listing_id, optional_params = {})
@@ -2,7 +2,7 @@ module Etsy4r
2
2
  class TagCommands < Etsy4r::Commands
3
3
 
4
4
  def get_top_tags
5
- @client.process("/tags/top")
5
+ @client.process("/tags")
6
6
  end
7
7
 
8
8
  def get_child_tags(tag)
@@ -31,6 +31,22 @@ describe Etsy4r::FavoriteCommands do
31
31
  end
32
32
  end
33
33
 
34
+ describe 'get_favorers_of_shop' do
35
+ it 'should return users who favor the shop' do
36
+ @res = @favorite_commands.get_favorers_of_shop(5565464)
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 accept the optional params' do
43
+ @res = @favorite_commands.get_favorers_of_shop(5565464, :detail_level => 'high', :limit => 5, :offset => 5)
44
+ @res.should be_success
45
+ @res.results.should_not be_nil
46
+ @res.error_message.should be_blank
47
+ end
48
+ end
49
+
34
50
  describe 'get_favorers_of_listing' do
35
51
  it 'should return users who favor the user' do
36
52
  @res = @favorite_commands.get_favorers_of_listing(19749826)
@@ -1 +1 @@
1
- --colour
1
+ --colour
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.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Cocca
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-03-01 00:00:00 -08:00
12
+ date: 2009-03-16 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency