commons 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gemtest +0 -0
- data/.gitignore +40 -0
- data/.rspec +2 -0
- data/.travis.yml +4 -0
- data/.yardopts +3 -0
- data/Gemfile +4 -0
- data/LICENSE.md +10 -0
- data/README.md +72 -0
- data/Rakefile +18 -0
- data/commons.gemspec +27 -0
- data/lib/commons.rb +24 -0
- data/lib/commons/client.rb +23 -0
- data/lib/commons/client/content.rb +17 -0
- data/lib/commons/configuration.rb +65 -0
- data/lib/commons/connection.rb +27 -0
- data/lib/commons/request.rb +16 -0
- data/lib/commons/version.rb +3 -0
- data/spec/commons/content_spec.rb +22 -0
- data/spec/commons_spec.rb +19 -0
- data/spec/fixtures/nodes.json +1 -0
- data/spec/helper.rb +25 -0
- metadata +191 -0
data/.gemtest
ADDED
File without changes
|
data/.gitignore
ADDED
@@ -0,0 +1,40 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
*.sw[a-p]
|
4
|
+
*.tmproj
|
5
|
+
*.tmproject
|
6
|
+
*.un~
|
7
|
+
*~
|
8
|
+
.DS_Store
|
9
|
+
.Spotlight-V100
|
10
|
+
.Trashes
|
11
|
+
._*
|
12
|
+
.bundle
|
13
|
+
.config
|
14
|
+
.directory
|
15
|
+
.elc
|
16
|
+
.emacs.desktop
|
17
|
+
.emacs.desktop.lock
|
18
|
+
.redcar
|
19
|
+
.yardoc
|
20
|
+
Desktop.ini
|
21
|
+
Gemfile.lock
|
22
|
+
Icon?
|
23
|
+
InstalledFiles
|
24
|
+
Session.vim
|
25
|
+
Thumbs.db
|
26
|
+
\#*\#
|
27
|
+
_yardoc
|
28
|
+
auto-save-list
|
29
|
+
coverage
|
30
|
+
doc
|
31
|
+
lib/bundler/man
|
32
|
+
pkg
|
33
|
+
pkg/*
|
34
|
+
rdoc
|
35
|
+
spec/reports
|
36
|
+
test/tmp
|
37
|
+
test/version_tmp
|
38
|
+
tmp
|
39
|
+
tmtags
|
40
|
+
tramp
|
data/.rspec
ADDED
data/.travis.yml
ADDED
data/.yardopts
ADDED
data/Gemfile
ADDED
data/LICENSE.md
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
Copyright (c) 2012, Code for America
|
2
|
+
All rights reserved.
|
3
|
+
|
4
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
5
|
+
|
6
|
+
* Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
7
|
+
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
8
|
+
* Neither the name of Code for America nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
|
9
|
+
|
10
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
data/README.md
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
#Commons
|
2
|
+
=======
|
3
|
+
A Ruby wrapper for the Civic Commons MarketPlace API at [http://marketplace.civiccommons.org/api](http://marketplace.civiccommons.org/api)
|
4
|
+
|
5
|
+
Does your project or organization use this gem?
|
6
|
+
------------------------------------------
|
7
|
+
Add it to the [apps](http://github.com/codeforamerica/commons/wiki/apps) wiki!
|
8
|
+
|
9
|
+
Installation
|
10
|
+
------------
|
11
|
+
$ gem install commons
|
12
|
+
|
13
|
+
Documentation
|
14
|
+
-------------
|
15
|
+
[http://rdoc.info/gems/commons](http://rdoc.info/gems/commons)
|
16
|
+
|
17
|
+
Continuous Integration
|
18
|
+
----------------------
|
19
|
+
[![Build Status](https://secure.travis-ci.org/codeforamerica/commons.png)](http://travis-ci.org/codeforamerica/commons)
|
20
|
+
|
21
|
+
Usage Examples
|
22
|
+
--------------
|
23
|
+
require 'commons'
|
24
|
+
|
25
|
+
@client = Commons::Client::New
|
26
|
+
a = @client.content("13813")
|
27
|
+
a.title # => "YouTown"
|
28
|
+
|
29
|
+
Contributing
|
30
|
+
------------
|
31
|
+
In the spirit of [free software](http://www.fsf.org/licensing/essays/free-sw.html), **everyone** is encouraged to help improve this project.
|
32
|
+
|
33
|
+
Here are some ways *you* can contribute:
|
34
|
+
|
35
|
+
* by using alpha, beta, and prerelease versions
|
36
|
+
* by reporting bugs
|
37
|
+
* by suggesting new features
|
38
|
+
* by writing or editing documentation
|
39
|
+
* by writing specifications
|
40
|
+
* by writing code (**no patch is too small**: fix typos, add comments, clean up inconsistent whitespace)
|
41
|
+
* by refactoring code
|
42
|
+
* by resolving [issues](http://github.com/codeforamerica/commons/issues)
|
43
|
+
* by reviewing patches
|
44
|
+
|
45
|
+
Submitting an Issue
|
46
|
+
-------------------
|
47
|
+
We use the [GitHub issue tracker](http://github.com/codeforamerica/commons/issues) to track bugs and
|
48
|
+
features. Before submitting a bug report or feature request, check to make sure it hasn't already
|
49
|
+
been submitted. You can indicate support for an existing issuse by voting it up. When submitting a
|
50
|
+
bug report, please include a [Gist](http://gist.github.com/) that includes a stack trace and any
|
51
|
+
details that may be necessary to reproduce the bug, including your gem version, Ruby version, and
|
52
|
+
operating system. Ideally, a bug report should include a pull request with failing specs.
|
53
|
+
|
54
|
+
Submitting a Pull Request
|
55
|
+
-------------------------
|
56
|
+
1. Fork the project.
|
57
|
+
2. Create a topic branch.
|
58
|
+
3. Implement your feature or bug fix.
|
59
|
+
4. Add documentation for your feature or bug fix.
|
60
|
+
5. Run <tt>bundle exec rake doc:yard</tt>. If your changes are not 100% documented, go back to step 4.
|
61
|
+
6. Add specs for your feature or bug fix.
|
62
|
+
7. Run <tt>bundle exec rake spec</tt>. If your changes are not 100% covered, go back to step 6.
|
63
|
+
8. Commit and push your changes.
|
64
|
+
9. Submit a pull request. Please do not include changes to the gemspec, version, or history file. (If you want to create your own version for some reason, please do so in a separate commit.)
|
65
|
+
|
66
|
+
Copyright
|
67
|
+
---------
|
68
|
+
Copyright (c) 2010 Code for America Laboratories
|
69
|
+
See [LICENSE](https://github.com/cfalabs/commons/blob/master/LICENSE.md) for details.
|
70
|
+
|
71
|
+
[![Code for America Tracker](http://stats.codeforamerica.org/codeforamerica/commons.png)](http://stats.codeforamerica.org/projects/commons)
|
72
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
|
3
|
+
require 'bundler'
|
4
|
+
Bundler::GemHelper.install_tasks
|
5
|
+
|
6
|
+
require 'rspec/core/rake_task'
|
7
|
+
RSpec::Core::RakeTask.new(:spec)
|
8
|
+
|
9
|
+
task :default => :spec
|
10
|
+
task :test => :spec
|
11
|
+
|
12
|
+
require 'yard'
|
13
|
+
namespace :doc do
|
14
|
+
YARD::Rake::YardocTask.new do |task|
|
15
|
+
task.files = ['LICENSE.md', 'lib/**/*.rb']
|
16
|
+
task.options = ['--markup', 'markdown']
|
17
|
+
end
|
18
|
+
end
|
data/commons.gemspec
ADDED
@@ -0,0 +1,27 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require File.expand_path('../lib/commons/version', __FILE__)
|
3
|
+
|
4
|
+
Gem::Specification.new do |gem|
|
5
|
+
gem.add_dependency 'faraday', '~> 0.7'
|
6
|
+
gem.add_dependency 'faraday_middleware', '~> 0.7'
|
7
|
+
gem.add_dependency 'hashie', '~> 1.2'
|
8
|
+
gem.add_dependency 'multi_json', '~> 1.0'
|
9
|
+
gem.add_dependency 'rash', '~> 0.3.2'
|
10
|
+
gem.add_development_dependency 'rake'
|
11
|
+
gem.add_development_dependency 'rdiscount'
|
12
|
+
gem.add_development_dependency 'rspec'
|
13
|
+
gem.add_development_dependency 'simplecov'
|
14
|
+
gem.add_development_dependency 'webmock'
|
15
|
+
gem.add_development_dependency 'yard'
|
16
|
+
gem.author = "Code for America"
|
17
|
+
gem.description = %q{Ruby Wrapper for the Civic Commons MarketPlace API - http://marketplace.civiccommons.org/api}
|
18
|
+
gem.email = 'ryan@codeforamerica.org'
|
19
|
+
gem.executables = `git ls-files -- bin/*`.split("\n").map{|f| File.basename(f)}
|
20
|
+
gem.files = `git ls-files`.split("\n")
|
21
|
+
gem.homepage = 'https://github.com/codeforamerica/commons'
|
22
|
+
gem.name = 'commons'
|
23
|
+
gem.require_paths = ['lib']
|
24
|
+
gem.summary = gem.description
|
25
|
+
gem.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
26
|
+
gem.version = Commons::VERSION
|
27
|
+
end
|
data/lib/commons.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'commons/configuration'
|
2
|
+
require 'commons/client'
|
3
|
+
|
4
|
+
module Commons
|
5
|
+
extend Configuration
|
6
|
+
class << self
|
7
|
+
# Alias for Commons::Client.new
|
8
|
+
#
|
9
|
+
# @return [Commons::Client]
|
10
|
+
def new(options={})
|
11
|
+
Commons::Client.new(options)
|
12
|
+
end
|
13
|
+
|
14
|
+
# Delegate to Commons::Client.new
|
15
|
+
def method_missing(method, *args, &block)
|
16
|
+
return super unless new.respond_to?(method)
|
17
|
+
new.send(method, *args, &block)
|
18
|
+
end
|
19
|
+
|
20
|
+
def respond_to?(method, include_private=false)
|
21
|
+
new.respond_to?(method, include_private) || super(method, include_private)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require 'commons/connection'
|
2
|
+
require 'commons/request'
|
3
|
+
|
4
|
+
require 'commons/client/content'
|
5
|
+
|
6
|
+
module Commons
|
7
|
+
class Client
|
8
|
+
attr_accessor(*Configuration::VALID_OPTIONS_KEYS)
|
9
|
+
|
10
|
+
def initialize(options={})
|
11
|
+
options = Commons.options.merge(options)
|
12
|
+
Configuration::VALID_OPTIONS_KEYS.each do |key|
|
13
|
+
send("#{key}=", options[key])
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
include Commons::Connection
|
18
|
+
include Commons::Request
|
19
|
+
|
20
|
+
include Commons::Client::Content
|
21
|
+
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
module Commons
|
2
|
+
class Client
|
3
|
+
module Content
|
4
|
+
# Use this query to get the information about one product
|
5
|
+
#
|
6
|
+
# @param id [String] The id for the product number
|
7
|
+
# @param options [Hash] A customizable set of options.
|
8
|
+
# @return [Array<Hashie::Mash>]
|
9
|
+
# @see http://marketplace.civiccommons.org/api
|
10
|
+
# @example
|
11
|
+
# Comments.content("13351")
|
12
|
+
def content(id,options={})
|
13
|
+
get("node/#{id}.json", options)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
require 'commons/version'
|
2
|
+
|
3
|
+
module Commons
|
4
|
+
# Defines constants and methods related to configuration
|
5
|
+
module Configuration
|
6
|
+
# An array of valid keys in the options hash when configuring a {SfPark::API}
|
7
|
+
VALID_OPTIONS_KEYS = [
|
8
|
+
:adapter,
|
9
|
+
:endpoint,
|
10
|
+
:proxy,
|
11
|
+
:response,
|
12
|
+
:user_agent,
|
13
|
+
:faraday_options].freeze
|
14
|
+
|
15
|
+
# The adapter that will be used to connect if none is set
|
16
|
+
DEFAULT_ADAPTER = :net_http
|
17
|
+
|
18
|
+
# The endpoint that will be used to connect if none is set
|
19
|
+
DEFAULT_ENDPOINT = 'http://marketplace.civiccommons.org/api/v1'.freeze
|
20
|
+
|
21
|
+
# The response format appended to the path and sent in the 'Accept' header if none is set
|
22
|
+
#
|
23
|
+
# @note JSON is preferred over XML because it is more concise and faster to parse.
|
24
|
+
DEFAULT_RESPONSE = :json
|
25
|
+
|
26
|
+
# By default, don't use a proxy server
|
27
|
+
DEFAULT_PROXY = nil
|
28
|
+
|
29
|
+
# The value sent in the 'User-Agent' header if none is set
|
30
|
+
DEFAULT_USER_AGENT = "Commons Ruby Gem #{Commons::VERSION}".freeze
|
31
|
+
|
32
|
+
DEFAULT_FARADAY_OPTIONS = {}.freeze
|
33
|
+
|
34
|
+
# @private
|
35
|
+
attr_accessor *VALID_OPTIONS_KEYS
|
36
|
+
|
37
|
+
# When this module is extended, set all configuration options to their default values
|
38
|
+
def self.extended(base)
|
39
|
+
base.reset
|
40
|
+
end
|
41
|
+
|
42
|
+
# Convenience method to allow configuration options to be set in a block
|
43
|
+
def configure
|
44
|
+
yield self
|
45
|
+
end
|
46
|
+
|
47
|
+
# Create a hash of options and their values
|
48
|
+
def options
|
49
|
+
options = {}
|
50
|
+
VALID_OPTIONS_KEYS.each{|k| options[k] = send(k)}
|
51
|
+
options
|
52
|
+
end
|
53
|
+
|
54
|
+
# Reset all configuration options to defaults
|
55
|
+
def reset
|
56
|
+
self.adapter = DEFAULT_ADAPTER
|
57
|
+
self.endpoint = DEFAULT_ENDPOINT
|
58
|
+
self.proxy = DEFAULT_PROXY
|
59
|
+
self.user_agent = DEFAULT_USER_AGENT
|
60
|
+
self.response = DEFAULT_RESPONSE
|
61
|
+
self.faraday_options = DEFAULT_FARADAY_OPTIONS
|
62
|
+
self
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
require 'faraday_middleware'
|
2
|
+
|
3
|
+
module Commons
|
4
|
+
module Connection
|
5
|
+
private
|
6
|
+
|
7
|
+
def connection(options={})
|
8
|
+
merged_options = faraday_options.merge({
|
9
|
+
:headers => {
|
10
|
+
'Accept' => "application/#{response}",
|
11
|
+
'User-Agent' => user_agent
|
12
|
+
},
|
13
|
+
:ssl => {:verify => false},
|
14
|
+
:url => endpoint
|
15
|
+
})
|
16
|
+
|
17
|
+
Faraday.new(merged_options) do |builder|
|
18
|
+
builder.use Faraday::Request::UrlEncoded
|
19
|
+
builder.use Faraday::Response::RaiseError
|
20
|
+
builder.use Faraday::Response::Rashify
|
21
|
+
builder.use Faraday::Response::Mashify
|
22
|
+
builder.use Faraday::Response::ParseJson
|
23
|
+
builder.adapter(Faraday.default_adapter)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module Commons
|
2
|
+
module Request
|
3
|
+
def get(path, options={})
|
4
|
+
request(:get, path, options)
|
5
|
+
end
|
6
|
+
|
7
|
+
private
|
8
|
+
|
9
|
+
def request(method, path, options)
|
10
|
+
response = connection.send(method) do |request|
|
11
|
+
request.url(path, options)
|
12
|
+
end
|
13
|
+
response.body
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
describe Commons::Client::Content do
|
4
|
+
before do
|
5
|
+
@client = Commons.new
|
6
|
+
end
|
7
|
+
|
8
|
+
describe "#content" do
|
9
|
+
context "get content" do
|
10
|
+
before do
|
11
|
+
stub_get("/node/13813.json").
|
12
|
+
to_return(:status => 200, :body => fixture("nodes.json"))
|
13
|
+
end
|
14
|
+
|
15
|
+
it "should return search the correct content node" do
|
16
|
+
node = @client.content('13813')
|
17
|
+
node.title.should == "YouTown"
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
22
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'helper'
|
2
|
+
|
3
|
+
describe Commons do
|
4
|
+
after do
|
5
|
+
Commons.reset
|
6
|
+
end
|
7
|
+
|
8
|
+
describe ".respond_to?" do
|
9
|
+
it "should be true if method exists" do
|
10
|
+
Commons.respond_to?(:new, true).should be_true
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
describe ".new" do
|
15
|
+
it "should return a Commons::Client" do
|
16
|
+
Commons.new.should be_a Commons::Client
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
{"vid":"13824","uid":"150","title":"YouTown","log":"","status":"1","comment":"1","promote":"0","sticky":"0","nid":"13813","type":"application","language":"und","created":"1324420273","changed":"1325695955","tnid":"0","translate":"0","revision_timestamp":"1325695955","revision_uid":"195","field_application_sdesc":{"und":[{"value":"A mobile app platform built for all government agencies and departments","format":null,"safe_value":"A mobile app platform built for all government agencies and departments"}]},"field_application_logo":{"und":[{"fid":"678","alt":"","title":"","uid":"150","filename":"DotGov logo 338x112 (1).png","uri":"public://content/applications/logos/DotGov logo 338x112 (1).png","filemime":"image/png","filesize":"15975","status":"1","timestamp":"1324420757","type":"image","rdf_mapping":[]}]},"field_application_rlss":[],"field_application_relapps":[],"field_application_featurs":[],"field_application_type":[],"field_application_creator":{"und":[{"nid":"13811"}]},"field_application_vendors":[],"field_application_hostname":[],"field_application_hosturl":[],"field_application_demourl":[],"field_application_license":[],"field_application_rating":{"und":[{"rating":null,"target":null}]},"field_application_description":{"und":[{"value":"Big-time metropolis? Small-budget township? YouTown brings a ready-made mobile platform to connect with your citizens to ANY community.\r\n\r\nConnecting busy citizens to their local governments can be tough. As more and more people rely on their mobile devices for handling day-to-day information and tasks, many cities are asking, \u201cHow can we take the initiative and make civic data available to our citizens in a mobile format?\u201d\r\n\r\nThe answer is simpler than you might think. No need to build your own application or break the budget. YouTown provides the platform, you provide the data -- and your community reaps the benefits.","format":"filtered_html","safe_value":"<p>Big-time metropolis? Small-budget township? YouTown brings a ready-made mobile platform to connect with your citizens to ANY community.</p>\n<p>Connecting busy citizens to their local governments can be tough. As more and more people rely on their mobile devices for handling day-to-day information and tasks, many cities are asking, \u201cHow can we take the initiative and make civic data available to our citizens in a mobile format?\u201d</p>\n<p>The answer is simpler than you might think. No need to build your own application or break the budget. YouTown provides the platform, you provide the data -- and your community reaps the benefits.</p>\n"}]},"field_application_reqs":[],"field_application_deliverymeth":[],"field_application_civfunction":{"und":[{"tid":"206"}]},"field_application_softfunction":[],"field_application_projects":[],"field_application_interactions":{"und":[{"nid":"13812"},{"nid":"13818"},{"nid":"13838"},{"nid":"13861"},{"nid":"13863"},{"nid":"13921"},{"nid":"13927"},{"nid":"13951"},{"nid":"13967"}]},"field_application_screenshots":[],"field_application_tutors":[],"field_application_ss_id":[],"field_application_homepage":{"und":[{"url":"http://youtown.com","title":null,"attributes":[]}]},"field_project_resulted":[],"field_application_stds":[],"field_application_tags":[],"rdf_mapping":{"rdftype":["sioc:Item","foaf:Document"],"title":{"predicates":["dc:title"]},"created":{"predicates":["dc:date","dc:created"],"datatype":"xsd:dateTime","callback":"date_iso8601"},"changed":{"predicates":["dc:modified"],"datatype":"xsd:dateTime","callback":"date_iso8601"},"body":{"predicates":["content:encoded"]},"uid":{"predicates":["sioc:has_creator"],"type":"rel"},"name":{"predicates":["foaf:name"]},"comment_count":{"predicates":["sioc:num_replies"],"datatype":"xsd:integer"},"last_activity":{"predicates":["sioc:last_activity_date"],"datatype":"xsd:dateTime","callback":"date_iso8601"}},"cid":"0","last_comment_timestamp":"1324420273","last_comment_name":null,"last_comment_uid":"150","comment_count":"0","name":"sidburgess","picture":"0","data":null,"path":"http://marketplace.civiccommons.org/apps/youtown"}
|
data/spec/helper.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
require 'simplecov'
|
2
|
+
SimpleCov.start
|
3
|
+
require 'commons'
|
4
|
+
require 'rspec'
|
5
|
+
require 'webmock/rspec'
|
6
|
+
|
7
|
+
def a_get(url)
|
8
|
+
a_request(:get, commons_url(url))
|
9
|
+
end
|
10
|
+
|
11
|
+
def stub_get(url)
|
12
|
+
stub_request(:get, commons_url(url))
|
13
|
+
end
|
14
|
+
|
15
|
+
def fixture_path
|
16
|
+
File.expand_path("../fixtures", __FILE__)
|
17
|
+
end
|
18
|
+
|
19
|
+
def fixture(file)
|
20
|
+
File.new(fixture_path + '/' + file)
|
21
|
+
end
|
22
|
+
|
23
|
+
def commons_url(url)
|
24
|
+
"http://marketplace.civiccommons.org/api/v1#{url}"
|
25
|
+
end
|
metadata
ADDED
@@ -0,0 +1,191 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: commons
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Code for America
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-01-31 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: faraday
|
16
|
+
requirement: &70211068357580 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0.7'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *70211068357580
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: faraday_middleware
|
27
|
+
requirement: &70211068356580 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ~>
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0.7'
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *70211068356580
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: hashie
|
38
|
+
requirement: &70211068351920 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ~>
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '1.2'
|
44
|
+
type: :runtime
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *70211068351920
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: multi_json
|
49
|
+
requirement: &70211068350480 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ~>
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.0'
|
55
|
+
type: :runtime
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *70211068350480
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: rash
|
60
|
+
requirement: &70211068349100 !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ~>
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: 0.3.2
|
66
|
+
type: :runtime
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: *70211068349100
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rake
|
71
|
+
requirement: &70211068348560 !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
73
|
+
requirements:
|
74
|
+
- - ! '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: *70211068348560
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
name: rdiscount
|
82
|
+
requirement: &70211068348100 !ruby/object:Gem::Requirement
|
83
|
+
none: false
|
84
|
+
requirements:
|
85
|
+
- - ! '>='
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0'
|
88
|
+
type: :development
|
89
|
+
prerelease: false
|
90
|
+
version_requirements: *70211068348100
|
91
|
+
- !ruby/object:Gem::Dependency
|
92
|
+
name: rspec
|
93
|
+
requirement: &70211068347520 !ruby/object:Gem::Requirement
|
94
|
+
none: false
|
95
|
+
requirements:
|
96
|
+
- - ! '>='
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '0'
|
99
|
+
type: :development
|
100
|
+
prerelease: false
|
101
|
+
version_requirements: *70211068347520
|
102
|
+
- !ruby/object:Gem::Dependency
|
103
|
+
name: simplecov
|
104
|
+
requirement: &70211068346780 !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
type: :development
|
111
|
+
prerelease: false
|
112
|
+
version_requirements: *70211068346780
|
113
|
+
- !ruby/object:Gem::Dependency
|
114
|
+
name: webmock
|
115
|
+
requirement: &70211068346360 !ruby/object:Gem::Requirement
|
116
|
+
none: false
|
117
|
+
requirements:
|
118
|
+
- - ! '>='
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: '0'
|
121
|
+
type: :development
|
122
|
+
prerelease: false
|
123
|
+
version_requirements: *70211068346360
|
124
|
+
- !ruby/object:Gem::Dependency
|
125
|
+
name: yard
|
126
|
+
requirement: &70211068345920 !ruby/object:Gem::Requirement
|
127
|
+
none: false
|
128
|
+
requirements:
|
129
|
+
- - ! '>='
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: *70211068345920
|
135
|
+
description: Ruby Wrapper for the Civic Commons MarketPlace API - http://marketplace.civiccommons.org/api
|
136
|
+
email: ryan@codeforamerica.org
|
137
|
+
executables: []
|
138
|
+
extensions: []
|
139
|
+
extra_rdoc_files: []
|
140
|
+
files:
|
141
|
+
- .gemtest
|
142
|
+
- .gitignore
|
143
|
+
- .rspec
|
144
|
+
- .travis.yml
|
145
|
+
- .yardopts
|
146
|
+
- Gemfile
|
147
|
+
- LICENSE.md
|
148
|
+
- README.md
|
149
|
+
- Rakefile
|
150
|
+
- commons.gemspec
|
151
|
+
- lib/commons.rb
|
152
|
+
- lib/commons/client.rb
|
153
|
+
- lib/commons/client/content.rb
|
154
|
+
- lib/commons/configuration.rb
|
155
|
+
- lib/commons/connection.rb
|
156
|
+
- lib/commons/request.rb
|
157
|
+
- lib/commons/version.rb
|
158
|
+
- spec/commons/content_spec.rb
|
159
|
+
- spec/commons_spec.rb
|
160
|
+
- spec/fixtures/nodes.json
|
161
|
+
- spec/helper.rb
|
162
|
+
homepage: https://github.com/codeforamerica/commons
|
163
|
+
licenses: []
|
164
|
+
post_install_message:
|
165
|
+
rdoc_options: []
|
166
|
+
require_paths:
|
167
|
+
- lib
|
168
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
169
|
+
none: false
|
170
|
+
requirements:
|
171
|
+
- - ! '>='
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: '0'
|
174
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
175
|
+
none: false
|
176
|
+
requirements:
|
177
|
+
- - ! '>='
|
178
|
+
- !ruby/object:Gem::Version
|
179
|
+
version: '0'
|
180
|
+
requirements: []
|
181
|
+
rubyforge_project:
|
182
|
+
rubygems_version: 1.8.11
|
183
|
+
signing_key:
|
184
|
+
specification_version: 3
|
185
|
+
summary: Ruby Wrapper for the Civic Commons MarketPlace API - http://marketplace.civiccommons.org/api
|
186
|
+
test_files:
|
187
|
+
- spec/commons/content_spec.rb
|
188
|
+
- spec/commons_spec.rb
|
189
|
+
- spec/fixtures/nodes.json
|
190
|
+
- spec/helper.rb
|
191
|
+
has_rdoc:
|