nation_builder 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: cccb7eb1c3d1dc53effa526e296fb742c9dc01a3
4
+ data.tar.gz: 3f277fbcb6b8a99dfbbb13a66bb860bb5ef4efc3
5
+ SHA512:
6
+ metadata.gz: 7a361ffd70ef869f8b23cfd42b063d1554ad43d145245e3f0e036060b3ddc1b18b7562eb048e29a492c6bb0220e6c78e94b796b66cca6cacef3d4982f77ec791
7
+ data.tar.gz: e3c3cc516ccd0e66e783175ab2fbf156ccee4122d0a807e68f4656edaa685cbcacc2725949a42f5b3c7eb894ca5d8aa5c5575afd3a063d00983b7386d2e1f844
data/.document ADDED
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/.rspec ADDED
@@ -0,0 +1 @@
1
+ --color
data/.ruby-gemset ADDED
@@ -0,0 +1 @@
1
+ nation_builder
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ ruby-2.0.0-p247
data/Gemfile ADDED
@@ -0,0 +1,11 @@
1
+ source "http://rubygems.org"
2
+
3
+ gem 'oauth2'
4
+
5
+ group :development do
6
+ gem 'pry'
7
+ gem 'pry-debugger'
8
+ gem "rspec"
9
+ gem "bundler"
10
+ gem "jeweler", "~> 1.8.7"
11
+ end
data/Gemfile.lock ADDED
@@ -0,0 +1,82 @@
1
+ GEM
2
+ remote: http://rubygems.org/
3
+ specs:
4
+ addressable (2.3.5)
5
+ builder (3.2.2)
6
+ coderay (1.0.9)
7
+ columnize (0.3.6)
8
+ debugger (1.6.1)
9
+ columnize (>= 0.3.1)
10
+ debugger-linecache (~> 1.2.0)
11
+ debugger-ruby_core_source (~> 1.2.3)
12
+ debugger-linecache (1.2.0)
13
+ debugger-ruby_core_source (1.2.3)
14
+ diff-lcs (1.2.4)
15
+ faraday (0.8.8)
16
+ multipart-post (~> 1.2.0)
17
+ git (1.2.6)
18
+ github_api (0.10.1)
19
+ addressable
20
+ faraday (~> 0.8.1)
21
+ hashie (>= 1.2)
22
+ multi_json (~> 1.4)
23
+ nokogiri (~> 1.5.2)
24
+ oauth2
25
+ hashie (2.0.5)
26
+ highline (1.6.19)
27
+ httpauth (0.2.0)
28
+ jeweler (1.8.7)
29
+ builder
30
+ bundler (~> 1.0)
31
+ git (>= 1.2.5)
32
+ github_api (= 0.10.1)
33
+ highline (>= 1.6.15)
34
+ nokogiri (= 1.5.10)
35
+ rake
36
+ rdoc
37
+ json (1.8.0)
38
+ jwt (0.1.8)
39
+ multi_json (>= 1.5)
40
+ method_source (0.8.2)
41
+ multi_json (1.8.0)
42
+ multi_xml (0.5.5)
43
+ multipart-post (1.2.0)
44
+ nokogiri (1.5.10)
45
+ oauth2 (0.9.2)
46
+ faraday (~> 0.8)
47
+ httpauth (~> 0.2)
48
+ jwt (~> 0.1.4)
49
+ multi_json (~> 1.0)
50
+ multi_xml (~> 0.5)
51
+ rack (~> 1.2)
52
+ pry (0.9.12.2)
53
+ coderay (~> 1.0.5)
54
+ method_source (~> 0.8)
55
+ slop (~> 3.4)
56
+ pry-debugger (0.2.2)
57
+ debugger (~> 1.3)
58
+ pry (~> 0.9.10)
59
+ rack (1.5.2)
60
+ rake (10.1.0)
61
+ rdoc (4.0.1)
62
+ json (~> 1.4)
63
+ rspec (2.14.1)
64
+ rspec-core (~> 2.14.0)
65
+ rspec-expectations (~> 2.14.0)
66
+ rspec-mocks (~> 2.14.0)
67
+ rspec-core (2.14.5)
68
+ rspec-expectations (2.14.2)
69
+ diff-lcs (>= 1.1.3, < 2.0)
70
+ rspec-mocks (2.14.3)
71
+ slop (3.4.6)
72
+
73
+ PLATFORMS
74
+ ruby
75
+
76
+ DEPENDENCIES
77
+ bundler
78
+ jeweler (~> 1.8.7)
79
+ oauth2
80
+ pry
81
+ pry-debugger
82
+ rspec
data/LICENSE.txt ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2013 ControlShift Labs
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/README.md ADDED
@@ -0,0 +1,20 @@
1
+ # nation_builder
2
+
3
+ A very simple ruby gem for interacting with NB people API.
4
+
5
+ http://nationbuilder.com/api_documentation
6
+
7
+ ## Usage
8
+
9
+ ```
10
+ require 'nation_builder'
11
+ client = NationBuilder.new(hostname: 'whatever.nationbuilder.com', client_id: 'id', client_secret: 'secret', username: 'you@nation.com', password: 'pass')
12
+ client.people.list # returns people in nation
13
+
14
+ ```
15
+
16
+ ## Copyright
17
+
18
+ Copyright (c) 2013 Nathan Woodhull. See LICENSE.txt for
19
+ further details.
20
+
data/Rakefile ADDED
@@ -0,0 +1,49 @@
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 = "nation_builder"
18
+ gem.homepage = "http://github.com/controlshift/nation_builder"
19
+ gem.license = "MIT"
20
+ gem.summary = "NationBuilder API wrapper"
21
+ gem.description = %Q{Ruby wrapper for NationBuilder API}
22
+ gem.email = "nathan@controlshiftlabs.com"
23
+ gem.authors = ["Nathan Woodhull", "Dan Schneiderman"]
24
+ # dependencies defined in Gemfile
25
+ end
26
+ Jeweler::RubygemsDotOrgTasks.new
27
+
28
+ require 'rspec/core'
29
+ require 'rspec/core/rake_task'
30
+ RSpec::Core::RakeTask.new(:spec) do |spec|
31
+ spec.pattern = FileList['spec/**/*_spec.rb']
32
+ end
33
+
34
+ RSpec::Core::RakeTask.new(:rcov) do |spec|
35
+ spec.pattern = 'spec/**/*_spec.rb'
36
+ spec.rcov = true
37
+ end
38
+
39
+ task :default => :spec
40
+
41
+ require 'rdoc/task'
42
+ Rake::RDocTask.new do |rdoc|
43
+ version = File.exist?('VERSION') ? File.read('VERSION') : ""
44
+
45
+ rdoc.rdoc_dir = 'rdoc'
46
+ rdoc.title = "nation_builder #{version}"
47
+ rdoc.rdoc_files.include('README*')
48
+ rdoc.rdoc_files.include('lib/**/*.rb')
49
+ end
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.1
@@ -0,0 +1,22 @@
1
+ module NationBuilder
2
+ class Client
3
+ attr_accessor :token, :client_secret, :client_id, :username, :password, :hostname
4
+
5
+ def initialize(args = {})
6
+ args.each do |key, value|
7
+ self.send("#{key}=".intern, value)
8
+ end
9
+ client = OAuth2::Client.new(client_id, client_secret, :site => "https://#{hostname}", authorize_url: "https://#{hostname}/oauth/authorize", token_url: "https://#{hostname}/oauth/token" )
10
+ self.token = client.password.get_token(username, password)
11
+ end
12
+
13
+
14
+ def people
15
+ NationBuilder::People.new(self)
16
+ end
17
+
18
+ def get(path)
19
+ self.token.get "https://#{hostname}/#{path}"
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,13 @@
1
+ module NationBuilder
2
+ class People
3
+ attr_accessor :client
4
+
5
+ def initialize(client)
6
+ self.client = client
7
+ end
8
+
9
+ def list()
10
+ JSON.parse(client.get('/api/v1/people').response.env[:body])
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,21 @@
1
+ require 'oauth2'
2
+ require 'nation_builder/client'
3
+ require 'nation_builder/people'
4
+
5
+ module NationBuilder
6
+
7
+ class << self
8
+ def new(options = {})
9
+ NationBuilder::Client.new(options)
10
+ end
11
+
12
+ def method_missing(method, *args)
13
+ return super unless new.respond_to?(method)
14
+ new.send(method, *args)
15
+ end
16
+
17
+ def respond_to?(method, include_private = false)
18
+ new.respond_to?(method, include_private) || super(method, include_private)
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,70 @@
1
+ # Generated by jeweler
2
+ # DO NOT EDIT THIS FILE DIRECTLY
3
+ # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
+ # -*- encoding: utf-8 -*-
5
+
6
+ Gem::Specification.new do |s|
7
+ s.name = "nation_builder"
8
+ s.version = "0.0.1"
9
+
10
+ s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
+ s.authors = ["Nathan Woodhull", "Dan Schneiderman"]
12
+ s.date = "2013-09-16"
13
+ s.description = "Ruby wrapper for NationBuilder API"
14
+ s.email = "nathan@controlshiftlabs.com"
15
+ s.extra_rdoc_files = [
16
+ "LICENSE.txt",
17
+ "README.md"
18
+ ]
19
+ s.files = [
20
+ ".document",
21
+ ".rspec",
22
+ ".ruby-gemset",
23
+ ".ruby-version",
24
+ "Gemfile",
25
+ "Gemfile.lock",
26
+ "LICENSE.txt",
27
+ "README.md",
28
+ "Rakefile",
29
+ "VERSION",
30
+ "lib/nation_builder.rb",
31
+ "lib/nation_builder/client.rb",
32
+ "lib/nation_builder/people.rb",
33
+ "nation_builder.gemspec",
34
+ "spec/nation_builder_spec.rb",
35
+ "spec/spec_helper.rb"
36
+ ]
37
+ s.homepage = "http://github.com/controlshift/nation_builder"
38
+ s.licenses = ["MIT"]
39
+ s.require_paths = ["lib"]
40
+ s.rubygems_version = "2.0.7"
41
+ s.summary = "NationBuilder API wrapper"
42
+
43
+ if s.respond_to? :specification_version then
44
+ s.specification_version = 4
45
+
46
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
47
+ s.add_runtime_dependency(%q<oauth2>, [">= 0"])
48
+ s.add_development_dependency(%q<pry>, [">= 0"])
49
+ s.add_development_dependency(%q<pry-debugger>, [">= 0"])
50
+ s.add_development_dependency(%q<rspec>, [">= 0"])
51
+ s.add_development_dependency(%q<bundler>, [">= 0"])
52
+ s.add_development_dependency(%q<jeweler>, ["~> 1.8.7"])
53
+ else
54
+ s.add_dependency(%q<oauth2>, [">= 0"])
55
+ s.add_dependency(%q<pry>, [">= 0"])
56
+ s.add_dependency(%q<pry-debugger>, [">= 0"])
57
+ s.add_dependency(%q<rspec>, [">= 0"])
58
+ s.add_dependency(%q<bundler>, [">= 0"])
59
+ s.add_dependency(%q<jeweler>, ["~> 1.8.7"])
60
+ end
61
+ else
62
+ s.add_dependency(%q<oauth2>, [">= 0"])
63
+ s.add_dependency(%q<pry>, [">= 0"])
64
+ s.add_dependency(%q<pry-debugger>, [">= 0"])
65
+ s.add_dependency(%q<rspec>, [">= 0"])
66
+ s.add_dependency(%q<bundler>, [">= 0"])
67
+ s.add_dependency(%q<jeweler>, ["~> 1.8.7"])
68
+ end
69
+ end
70
+
@@ -0,0 +1,7 @@
1
+ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
+
3
+ describe "NationBuilder" do
4
+ it "fails" do
5
+ fail "hey buddy, you should probably rename this file and start specing for real"
6
+ end
7
+ end
@@ -0,0 +1,12 @@
1
+ $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
2
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
3
+ require 'rspec'
4
+ require 'nation_builder'
5
+
6
+ # Requires supporting files with custom matchers and macros, etc,
7
+ # in ./support/ and its subdirectories.
8
+ Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
9
+
10
+ RSpec.configure do |config|
11
+
12
+ end
metadata ADDED
@@ -0,0 +1,146 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: nation_builder
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Nathan Woodhull
8
+ - Dan Schneiderman
9
+ autorequire:
10
+ bindir: bin
11
+ cert_chain: []
12
+ date: 2013-09-16 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
15
+ name: oauth2
16
+ requirement: !ruby/object:Gem::Requirement
17
+ requirements:
18
+ - - '>='
19
+ - !ruby/object:Gem::Version
20
+ version: '0'
21
+ type: :runtime
22
+ prerelease: false
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - '>='
26
+ - !ruby/object:Gem::Version
27
+ version: '0'
28
+ - !ruby/object:Gem::Dependency
29
+ name: pry
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - '>='
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ type: :development
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - '>='
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
42
+ - !ruby/object:Gem::Dependency
43
+ name: pry-debugger
44
+ requirement: !ruby/object:Gem::Requirement
45
+ requirements:
46
+ - - '>='
47
+ - !ruby/object:Gem::Version
48
+ version: '0'
49
+ type: :development
50
+ prerelease: false
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - '>='
54
+ - !ruby/object:Gem::Version
55
+ version: '0'
56
+ - !ruby/object:Gem::Dependency
57
+ name: rspec
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - '>='
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ - !ruby/object:Gem::Dependency
71
+ name: bundler
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - '>='
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
84
+ - !ruby/object:Gem::Dependency
85
+ name: jeweler
86
+ requirement: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - ~>
89
+ - !ruby/object:Gem::Version
90
+ version: 1.8.7
91
+ type: :development
92
+ prerelease: false
93
+ version_requirements: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - ~>
96
+ - !ruby/object:Gem::Version
97
+ version: 1.8.7
98
+ description: Ruby wrapper for NationBuilder API
99
+ email: nathan@controlshiftlabs.com
100
+ executables: []
101
+ extensions: []
102
+ extra_rdoc_files:
103
+ - LICENSE.txt
104
+ - README.md
105
+ files:
106
+ - .document
107
+ - .rspec
108
+ - .ruby-gemset
109
+ - .ruby-version
110
+ - Gemfile
111
+ - Gemfile.lock
112
+ - LICENSE.txt
113
+ - README.md
114
+ - Rakefile
115
+ - VERSION
116
+ - lib/nation_builder.rb
117
+ - lib/nation_builder/client.rb
118
+ - lib/nation_builder/people.rb
119
+ - nation_builder.gemspec
120
+ - spec/nation_builder_spec.rb
121
+ - spec/spec_helper.rb
122
+ homepage: http://github.com/controlshift/nation_builder
123
+ licenses:
124
+ - MIT
125
+ metadata: {}
126
+ post_install_message:
127
+ rdoc_options: []
128
+ require_paths:
129
+ - lib
130
+ required_ruby_version: !ruby/object:Gem::Requirement
131
+ requirements:
132
+ - - '>='
133
+ - !ruby/object:Gem::Version
134
+ version: '0'
135
+ required_rubygems_version: !ruby/object:Gem::Requirement
136
+ requirements:
137
+ - - '>='
138
+ - !ruby/object:Gem::Version
139
+ version: '0'
140
+ requirements: []
141
+ rubyforge_project:
142
+ rubygems_version: 2.0.7
143
+ signing_key:
144
+ specification_version: 4
145
+ summary: NationBuilder API wrapper
146
+ test_files: []