storenvy 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +12 -0
- data/Gemfile +10 -0
- data/README.md +34 -0
- data/Rakefile +15 -0
- data/lib/storenvy.rb +22 -0
- data/lib/storenvy/client.rb +31 -0
- data/lib/storenvy/version.rb +3 -0
- data/spec/helper.rb +4 -0
- data/spec/storenvy_spec.rb +4 -0
- data/storenvy.gemspec +29 -0
- metadata +103 -0
data/.gitignore
ADDED
data/Gemfile
ADDED
data/README.md
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
The Storenvy Ruby Gem
|
2
|
+
====================
|
3
|
+
A Ruby wrapper for the Storenvy REST API.
|
4
|
+
|
5
|
+
|
6
|
+
Installation
|
7
|
+
------------
|
8
|
+
gem install storenvy
|
9
|
+
|
10
|
+
|
11
|
+
Supported Rubies
|
12
|
+
----------------
|
13
|
+
* 1.8.7
|
14
|
+
* 1.9.2
|
15
|
+
|
16
|
+
|
17
|
+
Change Log
|
18
|
+
==========
|
19
|
+
|
20
|
+
0.0.1 - August 2nd 2012
|
21
|
+
--------------
|
22
|
+
* just starting out.
|
23
|
+
|
24
|
+
|
25
|
+
|
26
|
+
Copyright
|
27
|
+
---------
|
28
|
+
Copyright (c) 2012 Matt Anderson, [Tonka Park](http://tonkapark.com)
|
29
|
+
|
30
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
31
|
+
|
32
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
33
|
+
|
34
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'bundler'
|
3
|
+
Bundler::GemHelper.install_tasks
|
4
|
+
|
5
|
+
require 'rspec/core/rake_task'
|
6
|
+
|
7
|
+
desc "Default: run unit tests"
|
8
|
+
task :default => :spec
|
9
|
+
task :test => :spec
|
10
|
+
|
11
|
+
desc "Run all specs"
|
12
|
+
RSpec::Core::RakeTask.new do |t|
|
13
|
+
t.pattern = 'spec/**/*_spec.rb'
|
14
|
+
end
|
15
|
+
|
data/lib/storenvy.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'storenvy/client'
|
2
|
+
|
3
|
+
module Storenvy
|
4
|
+
class << self
|
5
|
+
# Alias for Storenvy::Client.new
|
6
|
+
#
|
7
|
+
# @return [Storenvy::Client]
|
8
|
+
def new(options={})
|
9
|
+
Storenvy::Client.new(options)
|
10
|
+
end
|
11
|
+
|
12
|
+
# Delegate to Storenvy::Client
|
13
|
+
def method_missing(method, *args, &block)
|
14
|
+
return super unless new.respond_to?(method)
|
15
|
+
new.send(method, *args, &block)
|
16
|
+
end
|
17
|
+
|
18
|
+
def respond_to?(method, include_private=false)
|
19
|
+
new.respond_to?(method, include_private) || super(method, include_private)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
require 'httparty'
|
2
|
+
require 'hashie'
|
3
|
+
|
4
|
+
module Storenvy
|
5
|
+
|
6
|
+
class Client
|
7
|
+
|
8
|
+
include HTTParty
|
9
|
+
headers 'Content-Type' => 'application/json'
|
10
|
+
|
11
|
+
def initialize(options={})
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.fetch(path)
|
15
|
+
response = get(path)
|
16
|
+
Hashie::Mash.new(response)
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.list(path, opts={})
|
20
|
+
response = get(path, :query => {'limit' => opts[:limit]})
|
21
|
+
response.map { |c| Hashie::Mash.new(c)}
|
22
|
+
end
|
23
|
+
|
24
|
+
|
25
|
+
##############################################
|
26
|
+
## HELPERS
|
27
|
+
private
|
28
|
+
|
29
|
+
|
30
|
+
end
|
31
|
+
end
|
data/spec/helper.rb
ADDED
data/storenvy.gemspec
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "storenvy/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "storenvy"
|
7
|
+
s.version = Storenvy::VERSION
|
8
|
+
s.platform = Gem::Platform::RUBY
|
9
|
+
s.authors = ["Matt Anderson"]
|
10
|
+
s.email = ["matt@tonkapark.com"]
|
11
|
+
s.homepage = "http://tonkapark.com"
|
12
|
+
s.summary = %q{Ruby wrapper for the Storenvy API}
|
13
|
+
s.description = %q{A Ruby wrapper for the Storenvy REST API}
|
14
|
+
|
15
|
+
|
16
|
+
s.add_runtime_dependency('httparty', '~> 0.8.1')
|
17
|
+
s.add_runtime_dependency('hashie', '~> 1.2.0')
|
18
|
+
|
19
|
+
s.add_development_dependency 'rspec'
|
20
|
+
s.add_development_dependency 'webmock'
|
21
|
+
|
22
|
+
|
23
|
+
s.rubyforge_project = s.name
|
24
|
+
|
25
|
+
s.files = `git ls-files`.split("\n")
|
26
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
27
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
28
|
+
s.require_paths = ["lib"]
|
29
|
+
end
|
metadata
ADDED
@@ -0,0 +1,103 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: storenvy
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Matt Anderson
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-08-02 00:00:00.000000000 -05:00
|
13
|
+
default_executable:
|
14
|
+
dependencies:
|
15
|
+
- !ruby/object:Gem::Dependency
|
16
|
+
name: httparty
|
17
|
+
requirement: &2153872040 !ruby/object:Gem::Requirement
|
18
|
+
none: false
|
19
|
+
requirements:
|
20
|
+
- - ~>
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 0.8.1
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: *2153872040
|
26
|
+
- !ruby/object:Gem::Dependency
|
27
|
+
name: hashie
|
28
|
+
requirement: &2153871420 !ruby/object:Gem::Requirement
|
29
|
+
none: false
|
30
|
+
requirements:
|
31
|
+
- - ~>
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 1.2.0
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: *2153871420
|
37
|
+
- !ruby/object:Gem::Dependency
|
38
|
+
name: rspec
|
39
|
+
requirement: &2153871040 !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
41
|
+
requirements:
|
42
|
+
- - ! '>='
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: '0'
|
45
|
+
type: :development
|
46
|
+
prerelease: false
|
47
|
+
version_requirements: *2153871040
|
48
|
+
- !ruby/object:Gem::Dependency
|
49
|
+
name: webmock
|
50
|
+
requirement: &2153870460 !ruby/object:Gem::Requirement
|
51
|
+
none: false
|
52
|
+
requirements:
|
53
|
+
- - ! '>='
|
54
|
+
- !ruby/object:Gem::Version
|
55
|
+
version: '0'
|
56
|
+
type: :development
|
57
|
+
prerelease: false
|
58
|
+
version_requirements: *2153870460
|
59
|
+
description: A Ruby wrapper for the Storenvy REST API
|
60
|
+
email:
|
61
|
+
- matt@tonkapark.com
|
62
|
+
executables: []
|
63
|
+
extensions: []
|
64
|
+
extra_rdoc_files: []
|
65
|
+
files:
|
66
|
+
- .gitignore
|
67
|
+
- Gemfile
|
68
|
+
- README.md
|
69
|
+
- Rakefile
|
70
|
+
- lib/storenvy.rb
|
71
|
+
- lib/storenvy/client.rb
|
72
|
+
- lib/storenvy/version.rb
|
73
|
+
- spec/helper.rb
|
74
|
+
- spec/storenvy_spec.rb
|
75
|
+
- storenvy.gemspec
|
76
|
+
has_rdoc: true
|
77
|
+
homepage: http://tonkapark.com
|
78
|
+
licenses: []
|
79
|
+
post_install_message:
|
80
|
+
rdoc_options: []
|
81
|
+
require_paths:
|
82
|
+
- lib
|
83
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
84
|
+
none: false
|
85
|
+
requirements:
|
86
|
+
- - ! '>='
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0'
|
89
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
90
|
+
none: false
|
91
|
+
requirements:
|
92
|
+
- - ! '>='
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: '0'
|
95
|
+
requirements: []
|
96
|
+
rubyforge_project: storenvy
|
97
|
+
rubygems_version: 1.6.2
|
98
|
+
signing_key:
|
99
|
+
specification_version: 3
|
100
|
+
summary: Ruby wrapper for the Storenvy API
|
101
|
+
test_files:
|
102
|
+
- spec/helper.rb
|
103
|
+
- spec/storenvy_spec.rb
|