svpply 0.0.1.alpha → 0.0.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/.gitignore CHANGED
@@ -16,3 +16,4 @@ test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
18
  *.DS_Store
19
+ spec/fixtures/vcr/*.yml
data/README.md CHANGED
@@ -1,12 +1,12 @@
1
1
  # Svpply
2
2
 
3
- This is a ruby wrapper for the Svpply API. It's a work in progress.
3
+ This is a ruby wrapper for the Svpply API. It's a work in progress, and currently not recommended for production usage.
4
4
 
5
5
  ## Installation
6
6
 
7
7
  Add this line to your application's Gemfile:
8
8
 
9
- gem 'svpply'
9
+ gem 'svpply', '0.0.1'
10
10
 
11
11
  And then execute:
12
12
 
@@ -36,6 +36,12 @@ Single product lookup:
36
36
 
37
37
  $ Svpply.product(880581)
38
38
 
39
+ Single product image permalink:
40
+
41
+ $ Svpply.product_image_permalink(880581, 'medium') # 450x450px (default)
42
+ $ Svpply.product_image_permalink(880581, 'small') # 195x195px
43
+ $ Svpply.product_image_permalink(880581, 'large') # 625x625px
44
+
39
45
 
40
46
  ### Categories
41
47
 
@@ -54,6 +60,39 @@ Categories have children categories:
54
60
 
55
61
  etc...
56
62
 
63
+ ### Stores
64
+
65
+ Single store lookup:
66
+
67
+ $ Svpply.store(48037)
68
+
69
+ Store products lookup:
70
+
71
+ $ Svpply.store_products(48037)
72
+ $ Svpply.store_products(48037, limit: 10, offset: 2)
73
+ $ Svpply.store_products(48037, genders: ['male'], prices: ['$1-20'])
74
+
75
+ ### Collections
76
+
77
+ Single collection lookup:
78
+
79
+ $ Svpply.collection(2032)
80
+
81
+ Collection products lookup:
82
+
83
+ $ Svpply.collection_products(2032)
84
+ $ Svpply.collection_products(2032, limit: 10, offset: 2)
85
+
86
+ ### Users
87
+
88
+ Single user lookup:
89
+
90
+ $ Svpply.user(4058)
91
+
92
+ Collection products lookup:
93
+
94
+ $ Svpply.user_products(4058)
95
+ $ Svpply.user_products(4058, limit: 10, offset: 2)
57
96
 
58
97
  ## TODO:
59
98
 
data/lib/svpply.rb CHANGED
@@ -5,6 +5,9 @@ require "svpply/product"
5
5
  require "svpply/product_collection"
6
6
  require "svpply/category"
7
7
  require "svpply/category_collection"
8
+ require "svpply/store"
9
+ require "svpply/collection"
10
+ require "svpply/user"
8
11
 
9
12
  module Svpply
10
13
  def self.products(*attributes)
@@ -15,8 +18,36 @@ module Svpply
15
18
  Product.find(id)
16
19
  end
17
20
 
21
+ def self.product_image_permalink(id, type)
22
+ Product.product_image_permalink(id, type)
23
+ end
24
+
18
25
  def self.categories
19
26
  Category.all
20
27
  end
21
28
 
29
+ def self.store(id)
30
+ Store.find(id)
31
+ end
32
+
33
+ def self.store_products(id, *attributes)
34
+ Store.products(id, attributes)
35
+ end
36
+
37
+ def self.collection(id)
38
+ Collection.find(id)
39
+ end
40
+
41
+ def self.collection_products(id, *attributes)
42
+ Collection.products(id, attributes)
43
+ end
44
+
45
+ def self.user(id)
46
+ User.find(id)
47
+ end
48
+
49
+ def self.user_products(id, *attributes)
50
+ User.products(id, attributes)
51
+ end
52
+
22
53
  end
@@ -0,0 +1,37 @@
1
+ module Svpply
2
+ class Collection
3
+ attr_reader :id, :title, :masthead, :masthead_height, :masthead_width, :preview_type,
4
+ :preview_image, :representative_item_id, :representative_item_width, :representative_item_height,
5
+ :products_count, :is_private, :is_wishlist, :date_created, :date_updated, :creator, :svpply_url
6
+
7
+ def self.find(id)
8
+ new(Client.get_response("/collections/#{id}.json")["collection"])
9
+ end
10
+
11
+ def self.products(id, attrs=nil)
12
+ ProductCollection.new(Client.get_response("/collections/#{id}/products.json", attrs)).products
13
+ end
14
+
15
+ def initialize(hash)
16
+ @id = hash["id"]
17
+ @title = hash["title"]
18
+ @masthead = hash["masthead"]
19
+ @masthead_height = hash["masthead_height"]
20
+ @masthead_width = hash["masthead_width"]
21
+ @preview_type = hash["preview_type"]
22
+ @preview_image = hash["preview_image"]
23
+ @representative_item_id = hash["representative_item_id"]
24
+ @representative_item_height = hash["representative_item_height"]
25
+ @representative_item_width = hash["representative_item_width"]
26
+ @products_count = hash["products_count"]
27
+ @is_private = hash["is_private"]
28
+ @is_wishlist = hash["is_wishlist"]
29
+ @date_created = hash["date_created"]
30
+ @date_updated = hash["date_updated"]
31
+ @creator = hash["creator"]
32
+ @creator["portrait"] = @creator["avatar"].gsub("avatars", "portraits")
33
+ @svpply_url = "https://svpply.com/collections/#{@id}"
34
+ end
35
+
36
+ end
37
+ end
@@ -1,7 +1,9 @@
1
1
  module Svpply
2
2
  class Product
3
- attr_reader :title, :price, :category, :gender, :image,
4
- :image_height, :image_width, :id, :saves, :notes, :url, :svpply_url
3
+ attr_reader :id, :title, :price, :formatted_price, :currency_code,
4
+ :discount, :discount_code, :category, :categories, :gender, :image,
5
+ :image_height, :image_width, :saves, :notes, :status_id,
6
+ :date_created, :date_updated, :url, :svpply_url
5
7
 
6
8
  def self.products(attrs=nil)
7
9
  unless attrs.empty?
@@ -15,19 +17,32 @@ module Svpply
15
17
  new(Client.get_response("/products/#{id}.json")["product"])
16
18
  end
17
19
 
20
+ def self.product_image_permalink(id, type='medium')
21
+ "https://api.svpply.com/v1/products/#{id}/image?type=#{type}"
22
+ end
23
+
18
24
  def initialize(hash)
25
+ @id = hash["id"]
19
26
  @title = hash["page_title"]
20
27
  @price = hash["price"]
28
+ @formatted_price = hash["formatted_price"]
29
+ @currency_code = hash["currency_code"]
30
+ @discount = hash["discount"]
31
+ @discount_code = hash["discount_code"]
21
32
  @category = hash["category"]
33
+ @categories = hash["categories"]
22
34
  @gender = hash["gender"]
23
35
  @image = hash["image"]
24
36
  @image_width = hash["image_width"]
25
37
  @image_height = hash["image_height"]
26
- @id = hash["id"]
27
38
  @saves = hash["saves"]
28
39
  @notes = hash["notes"]
40
+ @status_id = hash["status_id"]
29
41
  @url = hash["page_url"]
42
+ @date_created = hash["date_created"]
43
+ @date_updated = hash["date_updated"]
30
44
  @svpply_url = "https://svpply.com/item/#{@id}"
31
45
  end
46
+
32
47
  end
33
- end
48
+ end
@@ -0,0 +1,35 @@
1
+ module Svpply
2
+ class Store
3
+ attr_reader :id, :name, :slug, :url, :avatar, :description,
4
+ :products_count, :collections_count, :users_followers_count, :locations_count,
5
+ :masthead, :masthead_height, :masthead_width,
6
+ :date_created, :date_updated, :svpply_url
7
+
8
+ def self.find(id)
9
+ new(Client.get_response("/stores/#{id}.json")["store"])
10
+ end
11
+
12
+ def self.products(id, attrs=nil)
13
+ ProductCollection.new(Client.get_response("/stores/#{id}/products.json", attrs)).products
14
+ end
15
+
16
+ def initialize(hash)
17
+ @id = hash["id"]
18
+ @name = hash["name"]
19
+ @slug = hash["slug"]
20
+ @avatar = hash["avatar"]
21
+ @description = hash["description"]
22
+ @products_count = hash["products_count"]
23
+ @collections_count = hash["collections_count"]
24
+ @users_followers_count = hash["users_followers_count"]
25
+ @locations_count = hash["locations_count"]
26
+ @masthead = hash["masthead"]
27
+ @masthead_height = hash["masthead_height"]
28
+ @masthead_width = hash["masthead_width"]
29
+ @date_created = hash["date_created"]
30
+ @date_updated = hash["date_updated"]
31
+ @svpply_url = "https://svpply.com/#{@slug}"
32
+ end
33
+
34
+ end
35
+ end
@@ -0,0 +1,40 @@
1
+ module Svpply
2
+ class User
3
+ attr_reader :id, :name, :username, :url, :description,
4
+ :location, :display_name, :avatar, :gender_preference,
5
+ :products_count, :owns_count,
6
+ :users_following_count, :users_followers_count,
7
+ :stores_following_count, :searches_following_count,
8
+ :date_created, :date_updated, :svpply_url
9
+
10
+ def self.find(id)
11
+ new(Client.get_response("/users/#{id}.json")["user"])
12
+ end
13
+
14
+ def self.products(id, attrs=nil)
15
+ ProductCollection.new(Client.get_response("/users/#{id}/wants/products.json", attrs)).products
16
+ end
17
+
18
+ def initialize(hash)
19
+ @id = hash["id"]
20
+ @name = hash["name"]
21
+ @username = hash["username"]
22
+ @url = hash["url"]
23
+ @description = hash["description"]
24
+ @location = hash["location"]
25
+ @display_name = hash["display_name"]
26
+ @avatar = hash["avatar"]
27
+ @gender_preference = hash["gender_preference"]
28
+ @products_count = hash["products_count"]
29
+ @owns_count = hash["owns_count"]
30
+ @users_following_count = hash["users_following_count"]
31
+ @users_followers_count = hash["users_followers_count"]
32
+ @stores_following_count = hash["stores_following_count"]
33
+ @searches_following_count = hash["searches_following_count"]
34
+ @date_created = hash["date_created"]
35
+ @date_updated = hash["date_updated"]
36
+ @svpply_url = "https://svpply.com/#{@username}"
37
+ end
38
+
39
+ end
40
+ end
@@ -1,3 +1,3 @@
1
1
  module Svpply
2
- VERSION = "0.0.1.alpha"
2
+ VERSION = "0.0.1"
3
3
  end
@@ -0,0 +1,7 @@
1
+ require 'webmock'
2
+ require 'vcr'
3
+
4
+ VCR.configure do |c|
5
+ c.cassette_library_dir = 'spec/fixtures/vcr'
6
+ c.hook_into :webmock
7
+ end
data/spec/spec_helper.rb CHANGED
@@ -1,8 +1 @@
1
1
  require 'svpply'
2
- require 'webmock'
3
- require 'vcr'
4
-
5
- VCR.configure do |c|
6
- c.cassette_library_dir = 'spec/fixtures'
7
- c.hook_into :webmock
8
- end
metadata CHANGED
@@ -1,20 +1,19 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: svpply
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1.alpha
5
- prerelease: 6
4
+ version: 0.0.1
5
+ prerelease:
6
6
  platform: ruby
7
7
  authors:
8
8
  - Jeff Mehlhoff
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-04-10 00:00:00.000000000 -07:00
13
- default_executable:
12
+ date: 2012-11-08 00:00:00.000000000 Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: rspec
17
- requirement: &70099416888440 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
18
17
  none: false
19
18
  requirements:
20
19
  - - ! '>='
@@ -22,10 +21,15 @@ dependencies:
22
21
  version: '0'
23
22
  type: :development
24
23
  prerelease: false
25
- version_requirements: *70099416888440
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ! '>='
28
+ - !ruby/object:Gem::Version
29
+ version: '0'
26
30
  - !ruby/object:Gem::Dependency
27
31
  name: webmock
28
- requirement: &70099416888020 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
29
33
  none: false
30
34
  requirements:
31
35
  - - ! '>='
@@ -33,10 +37,15 @@ dependencies:
33
37
  version: '0'
34
38
  type: :development
35
39
  prerelease: false
36
- version_requirements: *70099416888020
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
37
46
  - !ruby/object:Gem::Dependency
38
47
  name: vcr
39
- requirement: &70099416887600 !ruby/object:Gem::Requirement
48
+ requirement: !ruby/object:Gem::Requirement
40
49
  none: false
41
50
  requirements:
42
51
  - - ! '>='
@@ -44,10 +53,15 @@ dependencies:
44
53
  version: '0'
45
54
  type: :development
46
55
  prerelease: false
47
- version_requirements: *70099416887600
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
48
62
  - !ruby/object:Gem::Dependency
49
63
  name: httparty
50
- requirement: &70099416887180 !ruby/object:Gem::Requirement
64
+ requirement: !ruby/object:Gem::Requirement
51
65
  none: false
52
66
  requirements:
53
67
  - - ! '>='
@@ -55,7 +69,12 @@ dependencies:
55
69
  version: '0'
56
70
  type: :runtime
57
71
  prerelease: false
58
- version_requirements: *70099416887180
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ! '>='
76
+ - !ruby/object:Gem::Version
77
+ version: '0'
59
78
  description: Ruby wrapper for the Svpply api
60
79
  email:
61
80
  - jeffmehlhoff@mac.com
@@ -71,16 +90,18 @@ files:
71
90
  - README.md
72
91
  - Rakefile
73
92
  - lib/svpply.rb
74
- - lib/svpply/.DS_Store
75
93
  - lib/svpply/category.rb
76
94
  - lib/svpply/category_collection.rb
77
95
  - lib/svpply/client.rb
96
+ - lib/svpply/collection.rb
78
97
  - lib/svpply/product.rb
79
98
  - lib/svpply/product_collection.rb
99
+ - lib/svpply/store.rb
100
+ - lib/svpply/user.rb
80
101
  - lib/svpply/version.rb
102
+ - spec/request_helper.rb
81
103
  - spec/spec_helper.rb
82
104
  - svpply.gemspec
83
- has_rdoc: true
84
105
  homepage: ''
85
106
  licenses: []
86
107
  post_install_message:
@@ -96,14 +117,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
96
117
  required_rubygems_version: !ruby/object:Gem::Requirement
97
118
  none: false
98
119
  requirements:
99
- - - ! '>'
120
+ - - ! '>='
100
121
  - !ruby/object:Gem::Version
101
- version: 1.3.1
122
+ version: '0'
102
123
  requirements: []
103
124
  rubyforge_project:
104
- rubygems_version: 1.6.2
125
+ rubygems_version: 1.8.24
105
126
  signing_key:
106
127
  specification_version: 3
107
128
  summary: ''
108
129
  test_files:
130
+ - spec/request_helper.rb
109
131
  - spec/spec_helper.rb