storesapp-rb 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore ADDED
@@ -0,0 +1 @@
1
+ .DS_Store
data/MIT-LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2010 Next Feature
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/Manifest.txt ADDED
@@ -0,0 +1,11 @@
1
+ lib/storesapp/base.rb
2
+ lib/storesapp/cart.rb
3
+ lib/storesapp/cart_line_item.rb
4
+ lib/storesapp/collection.rb
5
+ lib/storesapp/collection_product.rb
6
+ lib/storesapp/page.rb
7
+ lib/storesapp/product.rb
8
+ lib/storesapp/store.rb
9
+ lib/storesapp.rb
10
+ MIT-LICENSE
11
+ README
data/README ADDED
@@ -0,0 +1 @@
1
+ StoresApp-rb
@@ -0,0 +1,4 @@
1
+ module StoresApp
2
+ class Base < ActiveResource::Base
3
+ end
4
+ end
@@ -0,0 +1,7 @@
1
+ module StoresApp
2
+ class Cart < Base
3
+ # def line_items
4
+ # CartLineItem.find(:all, :from => "/cart/#{number}/line_items.xml")
5
+ # end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module StoresApp
2
+ class CartLineItem < Base
3
+ # def cart
4
+ # Cart.find(:one, :from => "/cart/#{number}.xml")
5
+ # end
6
+ end
7
+ end
@@ -0,0 +1,11 @@
1
+ module StoresApp
2
+ class Collection < Base
3
+ def collection_products
4
+ CollectionProduct.find(:all).select {|cp| cp.collection_id == id}
5
+ end
6
+
7
+ def products
8
+ Product.find(:all).select {|p| collection_products.collect {|cp| cp.product_id}.include?(p.id)}
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,4 @@
1
+ module StoresApp
2
+ class CollectionProduct < Base
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module StoresApp
2
+ class Page < Base
3
+ end
4
+ end
@@ -0,0 +1,11 @@
1
+ module StoresApp
2
+ class Product < Base
3
+ def collection_products
4
+ CollectionProduct.find(:all).select {|cp| cp.product_id == id}
5
+ end
6
+
7
+ def collections
8
+ Collection.find(:all).select {|c| collection_products.collect {|cp| cp.collection_id}.include?(c.id)}
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,15 @@
1
+ module StoresApp
2
+ class Store < Base
3
+ # def collections
4
+ # Collection.find(:all, :from => "/collections.xml")
5
+ # end
6
+ #
7
+ # def pages
8
+ # Page.find(:all, :from => "/pages.xml")
9
+ # end
10
+ #
11
+ # def products
12
+ # Product.find(:all, :from => "/products.xml")
13
+ # end
14
+ end
15
+ end
data/lib/storesapp.rb ADDED
@@ -0,0 +1,13 @@
1
+ require 'activesupport'
2
+ require 'activeresource'
3
+
4
+ $:.unshift(File.dirname(__FILE__))
5
+
6
+ require 'storesapp/base'
7
+ require 'storesapp/store'
8
+ # require 'storesapp/cart'
9
+ # require 'storesapp/cart_line_item'
10
+ require 'storesapp/collection'
11
+ require 'storesapp/collection_product'
12
+ require 'storesapp/product'
13
+ require 'storesapp/page'
data/storesapp.gemspec ADDED
@@ -0,0 +1,22 @@
1
+ #!/usr/bin/env gem build
2
+ # encoding: utf-8
3
+
4
+ Gem::Specification.new do |s|
5
+ s.name = "storesapp-rb"
6
+ s.version = "0.0.5"
7
+ s.authors = ["Next Feature"]
8
+ s.homepage = "http://github.com/nextfeature/storesapp-rb"
9
+ s.summary = "Ruby Gem for accessing the StoresApp API."
10
+ s.description = s.summary
11
+ s.cert_chain = nil
12
+ s.email = ["info@nextfeature.com"]
13
+ s.has_rdoc = false
14
+
15
+ s.required_rubygems_version = Gem::Requirement.new(">= 1.3.1") if s.respond_to?(:required_rubygems_version=)
16
+ s.rubygems_version = %q{1.3.1}
17
+ s.required_ruby_version = Gem::Requirement.new("~> 1.8")
18
+ s.files = `git ls-files`.split("\n")
19
+ s.require_paths = ["lib"]
20
+ s.add_dependency(%q<activesupport>, ["= 2.3.5"])
21
+ s.add_dependency(%q<activeresource>, ["= 2.3.5"])
22
+ end
metadata ADDED
@@ -0,0 +1,114 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: storesapp-rb
3
+ version: !ruby/object:Gem::Version
4
+ hash: 21
5
+ prerelease: false
6
+ segments:
7
+ - 0
8
+ - 0
9
+ - 5
10
+ version: 0.0.5
11
+ platform: ruby
12
+ authors:
13
+ - Next Feature
14
+ autorequire:
15
+ bindir: bin
16
+ cert_chain:
17
+ date: 2010-06-01 00:00:00 -04:00
18
+ default_executable:
19
+ dependencies:
20
+ - !ruby/object:Gem::Dependency
21
+ name: activesupport
22
+ prerelease: false
23
+ requirement: &id001 !ruby/object:Gem::Requirement
24
+ none: false
25
+ requirements:
26
+ - - "="
27
+ - !ruby/object:Gem::Version
28
+ hash: 9
29
+ segments:
30
+ - 2
31
+ - 3
32
+ - 5
33
+ version: 2.3.5
34
+ type: :runtime
35
+ version_requirements: *id001
36
+ - !ruby/object:Gem::Dependency
37
+ name: activeresource
38
+ prerelease: false
39
+ requirement: &id002 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - "="
43
+ - !ruby/object:Gem::Version
44
+ hash: 9
45
+ segments:
46
+ - 2
47
+ - 3
48
+ - 5
49
+ version: 2.3.5
50
+ type: :runtime
51
+ version_requirements: *id002
52
+ description: Ruby Gem for accessing the StoresApp API.
53
+ email:
54
+ - info@nextfeature.com
55
+ executables: []
56
+
57
+ extensions: []
58
+
59
+ extra_rdoc_files: []
60
+
61
+ files:
62
+ - .gitignore
63
+ - MIT-LICENSE
64
+ - Manifest.txt
65
+ - README
66
+ - lib/storesapp.rb
67
+ - lib/storesapp/base.rb
68
+ - lib/storesapp/cart.rb
69
+ - lib/storesapp/cart_line_item.rb
70
+ - lib/storesapp/collection.rb
71
+ - lib/storesapp/collection_product.rb
72
+ - lib/storesapp/page.rb
73
+ - lib/storesapp/product.rb
74
+ - lib/storesapp/store.rb
75
+ - storesapp.gemspec
76
+ has_rdoc: true
77
+ homepage: http://github.com/nextfeature/storesapp-rb
78
+ licenses: []
79
+
80
+ post_install_message:
81
+ rdoc_options: []
82
+
83
+ require_paths:
84
+ - lib
85
+ required_ruby_version: !ruby/object:Gem::Requirement
86
+ none: false
87
+ requirements:
88
+ - - ~>
89
+ - !ruby/object:Gem::Version
90
+ hash: 31
91
+ segments:
92
+ - 1
93
+ - 8
94
+ version: "1.8"
95
+ required_rubygems_version: !ruby/object:Gem::Requirement
96
+ none: false
97
+ requirements:
98
+ - - ">="
99
+ - !ruby/object:Gem::Version
100
+ hash: 25
101
+ segments:
102
+ - 1
103
+ - 3
104
+ - 1
105
+ version: 1.3.1
106
+ requirements: []
107
+
108
+ rubyforge_project:
109
+ rubygems_version: 1.3.7
110
+ signing_key:
111
+ specification_version: 3
112
+ summary: Ruby Gem for accessing the StoresApp API.
113
+ test_files: []
114
+