montabe 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/Gemfile ADDED
@@ -0,0 +1,19 @@
1
+ source "http://rubygems.org"
2
+ # Add dependencies required to use your gem here.
3
+ # Example:
4
+ # gem "activesupport", ">= 2.3.5"
5
+
6
+ # Add dependencies to develop your gem here.
7
+ # Include everything needed to run rake, tests, features, etc.
8
+
9
+ gem 'faraday', '~> 0.6.0'
10
+ gem 'faraday_middleware', '~> 0.6.0'
11
+ gem 'hashie', '~> 1.0.0'
12
+ gem 'multi_json'
13
+
14
+ group :development do
15
+ gem "shoulda", ">= 0"
16
+ gem "bundler", "~> 1.0.0"
17
+ gem "jeweler", "~> 1.6.0"
18
+ gem "rcov", ">= 0"
19
+ end
@@ -0,0 +1,35 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ addressable (2.2.6)
5
+ faraday (0.6.1)
6
+ addressable (~> 2.2.4)
7
+ multipart-post (~> 1.1.0)
8
+ rack (>= 1.1.0, < 2)
9
+ faraday_middleware (0.6.3)
10
+ faraday (~> 0.6.0)
11
+ git (1.2.5)
12
+ hashie (1.0.0)
13
+ jeweler (1.6.0)
14
+ bundler (~> 1.0.0)
15
+ git (>= 1.2.5)
16
+ rake
17
+ multi_json (1.0.2)
18
+ multipart-post (1.1.1)
19
+ rack (1.2.2)
20
+ rake (0.8.7)
21
+ rcov (0.9.9)
22
+ shoulda (2.11.3)
23
+
24
+ PLATFORMS
25
+ ruby
26
+
27
+ DEPENDENCIES
28
+ bundler (~> 1.0.0)
29
+ faraday (~> 0.6.0)
30
+ faraday_middleware (~> 0.6.0)
31
+ hashie (~> 1.0.0)
32
+ jeweler (~> 1.6.0)
33
+ multi_json
34
+ rcov
35
+ shoulda
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2011 Matt Mueller
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.
@@ -0,0 +1,36 @@
1
+ # montabe
2
+
3
+ Ruby wrapper for the [montabe API](http://montabe.com).
4
+
5
+ NOTE: both the API and this gem are currently in a complete alpha state. Stuff will change....and break.
6
+
7
+ ## Installation
8
+
9
+ gem install montabe
10
+
11
+ ## Usage
12
+
13
+ ### Instantiate a client
14
+
15
+ client = Montabe::Client.new
16
+
17
+ Then call your method.
18
+
19
+ ## Available Methods
20
+
21
+ client.gallery(GALLERY_NAME)
22
+
23
+
24
+ ## Contributing to montabe
25
+
26
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
27
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
28
+ * Fork the project
29
+ * Start a feature/bugfix branch
30
+ * Commit and push until you are happy with your contribution
31
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
32
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
33
+
34
+ ## Copyright
35
+
36
+ Copyright (c) 2011 Matt Mueller. See LICENSE.txt for further details.
@@ -0,0 +1,53 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+ require 'rake'
13
+
14
+ require 'jeweler'
15
+ Jeweler::Tasks.new do |gem|
16
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
17
+ gem.name = "montabe"
18
+ gem.homepage = "http://github.com/mattmueller/montabe"
19
+ gem.license = "MIT"
20
+ gem.summary = "Wrapper for the montabe API"
21
+ gem.description = "Wrapper for the montabe API. Currently in alpha state, stuff will break."
22
+ gem.email = "muellermr@gmail.com"
23
+ gem.authors = ["Matt Mueller"]
24
+ # dependencies defined in Gemfile
25
+ end
26
+ Jeweler::RubygemsDotOrgTasks.new
27
+
28
+ require 'rake/testtask'
29
+ Rake::TestTask.new(:test) do |test|
30
+ test.libs << 'lib' << 'test'
31
+ test.pattern = 'test/**/test_*.rb'
32
+ test.verbose = true
33
+ end
34
+
35
+ require 'rcov/rcovtask'
36
+ Rcov::RcovTask.new do |test|
37
+ test.libs << 'test'
38
+ test.pattern = 'test/**/test_*.rb'
39
+ test.verbose = true
40
+ test.rcov_opts << '--exclude "gems/*"'
41
+ end
42
+
43
+ task :default => :test
44
+
45
+ require 'rake/rdoctask'
46
+ Rake::RDocTask.new do |rdoc|
47
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
48
+
49
+ rdoc.rdoc_dir = 'rdoc'
50
+ rdoc.title = "montabe #{version}"
51
+ rdoc.rdoc_files.include('README*')
52
+ rdoc.rdoc_files.include('lib/**/*.rb')
53
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.1.3
@@ -0,0 +1,12 @@
1
+ require 'faraday'
2
+ require 'faraday_middleware'
3
+
4
+ directory = File.expand_path(File.dirname(__FILE__))
5
+
6
+ module Montabe
7
+
8
+ require 'montabe/galleries'
9
+ require 'montabe/client'
10
+
11
+
12
+ end
@@ -0,0 +1,49 @@
1
+ require 'forwardable'
2
+
3
+ module Montabe
4
+ class Client
5
+ extend Forwardable
6
+
7
+ include Galleries
8
+
9
+ def initialize(options={})
10
+ end
11
+
12
+ # Sets up the connection to be used for all requests based on options passed during initialization.
13
+
14
+ def connection
15
+ params = {}
16
+ @connection ||= Faraday::Connection.new(:url => api_url, :params => params, :headers => default_headers) do |builder|
17
+ builder.adapter Faraday.default_adapter
18
+ builder.use Faraday::Response::Mashify
19
+ builder.use Faraday::Response::ParseJson
20
+ end
21
+ end
22
+
23
+ # Base URL for api requests.
24
+
25
+ def api_url
26
+ "http://demo.montabe.com"
27
+ end
28
+
29
+ # Helper method to return errors or desired response data as appropriate.
30
+ #
31
+ # Added just for convenience to avoid having to traverse farther down the response just to get to returned data.
32
+
33
+ def return_error_or_body(response, response_body)
34
+ response.status == 200 ? response_body : response.body
35
+ end
36
+
37
+ private
38
+
39
+
40
+ def default_headers
41
+ headers = {
42
+ :accept => 'application/json',
43
+ :user_agent => 'Ruby gem'
44
+ }
45
+ end
46
+
47
+ end
48
+ end
49
+
@@ -0,0 +1,13 @@
1
+ module Montabe
2
+ module Galleries
3
+
4
+ # Retrieve a gallery
5
+ #
6
+ # param [String] gallery_name The name of the gallery
7
+
8
+ def gallery(gallery_name)
9
+ response = connection.get("galleries/#{gallery_name}")
10
+ return_error_or_body(response, response.body.galleries)
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,18 @@
1
+ require 'rubygems'
2
+ require 'bundler'
3
+ begin
4
+ Bundler.setup(:default, :development)
5
+ rescue Bundler::BundlerError => e
6
+ $stderr.puts e.message
7
+ $stderr.puts "Run `bundle install` to install missing gems"
8
+ exit e.status_code
9
+ end
10
+ require 'test/unit'
11
+ require 'shoulda'
12
+
13
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
14
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
15
+ require 'montabe'
16
+
17
+ class Test::Unit::TestCase
18
+ end
@@ -0,0 +1,7 @@
1
+ require 'helper'
2
+
3
+ class TestMontabe < Test::Unit::TestCase
4
+ should "probably rename this file and start testing for real" do
5
+ flunk "hey buddy, you should probably rename this file and start testing for real"
6
+ end
7
+ end
metadata ADDED
@@ -0,0 +1,152 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: montabe
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.3
5
+ prerelease:
6
+ platform: ruby
7
+ authors:
8
+ - Matt Mueller
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2011-05-14 00:00:00.000000000 -05:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: faraday
17
+ requirement: &13719200 !ruby/object:Gem::Requirement
18
+ none: false
19
+ requirements:
20
+ - - ~>
21
+ - !ruby/object:Gem::Version
22
+ version: 0.6.0
23
+ type: :runtime
24
+ prerelease: false
25
+ version_requirements: *13719200
26
+ - !ruby/object:Gem::Dependency
27
+ name: faraday_middleware
28
+ requirement: &13717620 !ruby/object:Gem::Requirement
29
+ none: false
30
+ requirements:
31
+ - - ~>
32
+ - !ruby/object:Gem::Version
33
+ version: 0.6.0
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: *13717620
37
+ - !ruby/object:Gem::Dependency
38
+ name: hashie
39
+ requirement: &13714660 !ruby/object:Gem::Requirement
40
+ none: false
41
+ requirements:
42
+ - - ~>
43
+ - !ruby/object:Gem::Version
44
+ version: 1.0.0
45
+ type: :runtime
46
+ prerelease: false
47
+ version_requirements: *13714660
48
+ - !ruby/object:Gem::Dependency
49
+ name: multi_json
50
+ requirement: &13713280 !ruby/object:Gem::Requirement
51
+ none: false
52
+ requirements:
53
+ - - ! '>='
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ type: :runtime
57
+ prerelease: false
58
+ version_requirements: *13713280
59
+ - !ruby/object:Gem::Dependency
60
+ name: shoulda
61
+ requirement: &13711540 !ruby/object:Gem::Requirement
62
+ none: false
63
+ requirements:
64
+ - - ! '>='
65
+ - !ruby/object:Gem::Version
66
+ version: '0'
67
+ type: :development
68
+ prerelease: false
69
+ version_requirements: *13711540
70
+ - !ruby/object:Gem::Dependency
71
+ name: bundler
72
+ requirement: &13709800 !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: 1.0.0
78
+ type: :development
79
+ prerelease: false
80
+ version_requirements: *13709800
81
+ - !ruby/object:Gem::Dependency
82
+ name: jeweler
83
+ requirement: &13708440 !ruby/object:Gem::Requirement
84
+ none: false
85
+ requirements:
86
+ - - ~>
87
+ - !ruby/object:Gem::Version
88
+ version: 1.6.0
89
+ type: :development
90
+ prerelease: false
91
+ version_requirements: *13708440
92
+ - !ruby/object:Gem::Dependency
93
+ name: rcov
94
+ requirement: &13706620 !ruby/object:Gem::Requirement
95
+ none: false
96
+ requirements:
97
+ - - ! '>='
98
+ - !ruby/object:Gem::Version
99
+ version: '0'
100
+ type: :development
101
+ prerelease: false
102
+ version_requirements: *13706620
103
+ description: Wrapper for the montabe API. Currently in alpha state, stuff will break.
104
+ email: muellermr@gmail.com
105
+ executables: []
106
+ extensions: []
107
+ extra_rdoc_files:
108
+ - LICENSE.txt
109
+ - README.md
110
+ files:
111
+ - .document
112
+ - Gemfile
113
+ - Gemfile.lock
114
+ - LICENSE.txt
115
+ - README.md
116
+ - Rakefile
117
+ - VERSION
118
+ - lib/montabe.rb
119
+ - lib/montabe/client.rb
120
+ - lib/montabe/galleries.rb
121
+ - test/helper.rb
122
+ - test/test_montabe.rb
123
+ has_rdoc: true
124
+ homepage: http://github.com/mattmueller/montabe
125
+ licenses:
126
+ - MIT
127
+ post_install_message:
128
+ rdoc_options: []
129
+ require_paths:
130
+ - lib
131
+ required_ruby_version: !ruby/object:Gem::Requirement
132
+ none: false
133
+ requirements:
134
+ - - ! '>='
135
+ - !ruby/object:Gem::Version
136
+ version: '0'
137
+ segments:
138
+ - 0
139
+ hash: 1559471238980334611
140
+ required_rubygems_version: !ruby/object:Gem::Requirement
141
+ none: false
142
+ requirements:
143
+ - - ! '>='
144
+ - !ruby/object:Gem::Version
145
+ version: '0'
146
+ requirements: []
147
+ rubyforge_project:
148
+ rubygems_version: 1.6.2
149
+ signing_key:
150
+ specification_version: 3
151
+ summary: Wrapper for the montabe API
152
+ test_files: []