porpoise_external_actions 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/.travis.yml +3 -0
- data/Gemfile +14 -0
- data/Gemfile.lock +108 -0
- data/LICENSE.txt +20 -0
- data/README.md +30 -0
- data/Rakefile +49 -0
- data/VERSION +1 -0
- data/lib/porpoise_external_actions.rb +17 -0
- data/lib/porpoise_external_actions/action.rb +11 -0
- data/lib/porpoise_external_actions/client.rb +48 -0
- data/lib/porpoise_external_actions/exception_middleware.rb +35 -0
- data/lib/porpoise_external_actions/model.rb +14 -0
- data/spec/action_spec.rb +53 -0
- data/spec/client_spec.rb +33 -0
- data/spec/model_spec.rb +11 -0
- data/spec/porpoise_external_actions_spec.rb +6 -0
- data/spec/spec_helper.rb +43 -0
- metadata +162 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 55a29b645eba55bed8dba2ee37d8ddb4ac008b2c
|
4
|
+
data.tar.gz: b54bbc0c9f8bc0aeeed4d59350bfb2f8216cdf88
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 074b9c878017d82b27cbee8cf800c7dc028809b37bee591793dddf171316a1b13a3bfc04d37cacf81f212b5968e099445c608cbf5d4c1494b5910a354feaa67c
|
7
|
+
data.tar.gz: f0108f4170f7b0e40282baebe08514d6531ff985891464e5294f24c3ba396585560bd0385a84c4392c822a471a610d7d7fe39af8a1659734b44a6b10da050d2f
|
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
porpoise_external_actions
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby-2.0.0-p247
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
source "http://rubygems.org"
|
2
|
+
|
3
|
+
gem 'vertebrae'
|
4
|
+
|
5
|
+
# Add dependencies to develop your gem here.
|
6
|
+
# Include everything needed to run rake, tests, features, etc.
|
7
|
+
group :development do
|
8
|
+
gem 'webmock'
|
9
|
+
gem 'pry'
|
10
|
+
gem 'pry-debugger'
|
11
|
+
gem "rspec"
|
12
|
+
gem "bundler"
|
13
|
+
gem "jeweler", "~> 1.8.4"
|
14
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,108 @@
|
|
1
|
+
GEM
|
2
|
+
remote: http://rubygems.org/
|
3
|
+
specs:
|
4
|
+
activesupport (4.0.0)
|
5
|
+
i18n (~> 0.6, >= 0.6.4)
|
6
|
+
minitest (~> 4.2)
|
7
|
+
multi_json (~> 1.3)
|
8
|
+
thread_safe (~> 0.1)
|
9
|
+
tzinfo (~> 0.3.37)
|
10
|
+
addressable (2.3.5)
|
11
|
+
atomic (1.1.14)
|
12
|
+
builder (3.2.2)
|
13
|
+
coderay (1.0.9)
|
14
|
+
columnize (0.3.6)
|
15
|
+
crack (0.4.1)
|
16
|
+
safe_yaml (~> 0.9.0)
|
17
|
+
debugger (1.6.1)
|
18
|
+
columnize (>= 0.3.1)
|
19
|
+
debugger-linecache (~> 1.2.0)
|
20
|
+
debugger-ruby_core_source (~> 1.2.3)
|
21
|
+
debugger-linecache (1.2.0)
|
22
|
+
debugger-ruby_core_source (1.2.3)
|
23
|
+
diff-lcs (1.2.4)
|
24
|
+
faraday (0.8.8)
|
25
|
+
multipart-post (~> 1.2.0)
|
26
|
+
faraday_middleware (0.9.0)
|
27
|
+
faraday (>= 0.7.4, < 0.9)
|
28
|
+
git (1.2.5)
|
29
|
+
github_api (0.10.1)
|
30
|
+
addressable
|
31
|
+
faraday (~> 0.8.1)
|
32
|
+
hashie (>= 1.2)
|
33
|
+
multi_json (~> 1.4)
|
34
|
+
nokogiri (~> 1.5.2)
|
35
|
+
oauth2
|
36
|
+
hashie (2.0.5)
|
37
|
+
highline (1.6.19)
|
38
|
+
httpauth (0.2.0)
|
39
|
+
i18n (0.6.5)
|
40
|
+
jeweler (1.8.6)
|
41
|
+
builder
|
42
|
+
bundler (~> 1.0)
|
43
|
+
git (>= 1.2.5)
|
44
|
+
github_api (= 0.10.1)
|
45
|
+
highline (>= 1.6.15)
|
46
|
+
nokogiri (= 1.5.10)
|
47
|
+
rake
|
48
|
+
rdoc
|
49
|
+
json (1.8.0)
|
50
|
+
jwt (0.1.8)
|
51
|
+
multi_json (>= 1.5)
|
52
|
+
method_source (0.8.2)
|
53
|
+
minitest (4.7.5)
|
54
|
+
multi_json (1.8.0)
|
55
|
+
multi_xml (0.5.4)
|
56
|
+
multipart-post (1.2.0)
|
57
|
+
nokogiri (1.5.10)
|
58
|
+
oauth2 (0.9.2)
|
59
|
+
faraday (~> 0.8)
|
60
|
+
httpauth (~> 0.2)
|
61
|
+
jwt (~> 0.1.4)
|
62
|
+
multi_json (~> 1.0)
|
63
|
+
multi_xml (~> 0.5)
|
64
|
+
rack (~> 1.2)
|
65
|
+
pry (0.9.12.2)
|
66
|
+
coderay (~> 1.0.5)
|
67
|
+
method_source (~> 0.8)
|
68
|
+
slop (~> 3.4)
|
69
|
+
pry-debugger (0.2.2)
|
70
|
+
debugger (~> 1.3)
|
71
|
+
pry (~> 0.9.10)
|
72
|
+
rack (1.5.2)
|
73
|
+
rake (10.1.0)
|
74
|
+
rdoc (4.0.1)
|
75
|
+
json (~> 1.4)
|
76
|
+
rspec (2.14.1)
|
77
|
+
rspec-core (~> 2.14.0)
|
78
|
+
rspec-expectations (~> 2.14.0)
|
79
|
+
rspec-mocks (~> 2.14.0)
|
80
|
+
rspec-core (2.14.2)
|
81
|
+
rspec-expectations (2.14.0)
|
82
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
83
|
+
rspec-mocks (2.14.1)
|
84
|
+
safe_yaml (0.9.4)
|
85
|
+
slop (3.4.6)
|
86
|
+
thread_safe (0.1.3)
|
87
|
+
atomic
|
88
|
+
tzinfo (0.3.37)
|
89
|
+
vertebrae (0.2.0)
|
90
|
+
activesupport
|
91
|
+
faraday
|
92
|
+
faraday_middleware
|
93
|
+
hashie
|
94
|
+
webmock (1.13.0)
|
95
|
+
addressable (>= 2.2.7)
|
96
|
+
crack (>= 0.3.2)
|
97
|
+
|
98
|
+
PLATFORMS
|
99
|
+
ruby
|
100
|
+
|
101
|
+
DEPENDENCIES
|
102
|
+
bundler
|
103
|
+
jeweler (~> 1.8.4)
|
104
|
+
pry
|
105
|
+
pry-debugger
|
106
|
+
rspec
|
107
|
+
vertebrae
|
108
|
+
webmock
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2013 ControlShift Ltd.
|
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,30 @@
|
|
1
|
+
porpoise_external_actions
|
2
|
+
=========================
|
3
|
+
|
4
|
+
An API client in ruby for the Purpose Platform External Actions API
|
5
|
+
|
6
|
+
[![Build Status](https://travis-ci.org/controlshift/porpoise_external_actions.png)](https://travis-ci.org/controlshift/porpoise_external_actions)
|
7
|
+
|
8
|
+
## Usage
|
9
|
+
|
10
|
+
```
|
11
|
+
require 'porpoise_external_actions'
|
12
|
+
|
13
|
+
# setup an API client.
|
14
|
+
client = PorpoiseExternalActions.new(host: 'test.herokuapp.com', username: 'controlshift', password: 'controlshift', movement_id: 'controlshift')
|
15
|
+
|
16
|
+
# send an action
|
17
|
+
response = client.action.create { source: 'foo', role: 'signer', action_slug: "slug", action_language_iso: "en", activity: "action_taken", user: { email: "foo@bar.com"}}
|
18
|
+
|
19
|
+
response # is a Farraday::Response object, API always returns an empty body with 201 status.
|
20
|
+
```
|
21
|
+
|
22
|
+
### Exceptions
|
23
|
+
|
24
|
+
* PorpoiseInvalidException - thrown for validation exceptions, when API return 422. Contains error message raw response.
|
25
|
+
* PorpoiseException - thrown when endpoint returns 500. Contains error message and raw http response
|
26
|
+
|
27
|
+
|
28
|
+
## Purpose API Documentation
|
29
|
+
|
30
|
+
https://github.com/PurposeOpen/Platform/wiki/Create-External-Activity-Event
|
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 = "porpoise_external_actions"
|
18
|
+
gem.homepage = "http://github.com/controlshift/porpoise_external_actions"
|
19
|
+
gem.license = "MIT"
|
20
|
+
gem.summary = %Q{API client for Purpose Platform External Actions }
|
21
|
+
gem.description = %Q{An API client for the Purpose Platform}
|
22
|
+
gem.email = "nathan@controlshiftlabs.com"
|
23
|
+
gem.authors = ["Nathan Woodhull"]
|
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 = "porpoise_external_actions #{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,17 @@
|
|
1
|
+
require 'vertebrae'
|
2
|
+
require 'porpoise_external_actions/model'
|
3
|
+
require 'porpoise_external_actions/action'
|
4
|
+
require 'porpoise_external_actions/client'
|
5
|
+
require 'porpoise_external_actions/exception_middleware'
|
6
|
+
|
7
|
+
module PorpoiseExternalActions
|
8
|
+
extend Vertebrae::Base
|
9
|
+
|
10
|
+
class << self
|
11
|
+
def new(options = {})
|
12
|
+
PorpoiseExternalActions::Client.new(options) do
|
13
|
+
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
module PorpoiseExternalActions
|
2
|
+
class Client < Vertebrae::API
|
3
|
+
def action
|
4
|
+
@action ||= PorpoiseExternalActions::Action.new(client: self)
|
5
|
+
end
|
6
|
+
|
7
|
+
def default_options
|
8
|
+
{
|
9
|
+
user_agent: 'PorpoiseExternalActionsGem',
|
10
|
+
prefix: '',
|
11
|
+
content_type: 'application/x-www-form-urlencoded'
|
12
|
+
}
|
13
|
+
end
|
14
|
+
|
15
|
+
def request(method, path, params, options) # :nodoc:
|
16
|
+
if !::Vertebrae::Request::METHODS.include?(method)
|
17
|
+
raise ArgumentError, "unknown http method: #{method}"
|
18
|
+
end
|
19
|
+
|
20
|
+
path = connection.configuration.prefix + '/' + path
|
21
|
+
|
22
|
+
::Vertebrae::Base.logger.debug "EXECUTED: #{method} - #{path} with #{params} and #{options}"
|
23
|
+
|
24
|
+
connection.connection.send(method) do |request|
|
25
|
+
|
26
|
+
case method.to_sym
|
27
|
+
when *(::Vertebrae::Request::METHODS - ::Vertebrae::Request::METHODS_WITH_BODIES)
|
28
|
+
request.url(path, params)
|
29
|
+
when *::Vertebrae::Request::METHODS_WITH_BODIES
|
30
|
+
request.path = path
|
31
|
+
request.body = params unless params.empty?
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
def setup
|
37
|
+
connection.stack do |builder|
|
38
|
+
builder.use Faraday::Request::UrlEncoded
|
39
|
+
builder.use Vertebrae::Request::BasicAuth, connection.configuration.authentication if connection.configuration.authenticated?
|
40
|
+
|
41
|
+
builder.use Faraday::Response::Logger if ENV['DEBUG']
|
42
|
+
|
43
|
+
builder.use PorpoiseExternalActions::ExceptionMiddleware # Vertebrae::Response::RaiseError
|
44
|
+
builder.adapter connection.configuration.adapter
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
module PorpoiseExternalActions
|
2
|
+
class ExceptionMiddleware < Faraday::Response::Middleware
|
3
|
+
|
4
|
+
def on_complete(response)
|
5
|
+
status_code = response[:status].to_i
|
6
|
+
if status_code == 500
|
7
|
+
message = JSON.parse(response[:body])['error']
|
8
|
+
raise PorpoiseException.new(message, response)
|
9
|
+
elsif status_code == 422
|
10
|
+
fields = JSON.parse(response[:body])
|
11
|
+
raise PorpoiseInvalidException.new("validation error", response, fields)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
class PorpoiseException < Exception
|
17
|
+
attr_accessor :message, :http_response
|
18
|
+
|
19
|
+
def initialize(message, response = nil)
|
20
|
+
super(message)
|
21
|
+
self.message = message
|
22
|
+
self.http_response = response
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
class PorpoiseInvalidException < PorpoiseException
|
27
|
+
attr_accessor :fields
|
28
|
+
|
29
|
+
def initialize message, response, fields = nil
|
30
|
+
super(message, response)
|
31
|
+
self.fields = fields
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module PorpoiseExternalActions
|
2
|
+
class Model < Vertebrae::Model
|
3
|
+
attr_accessor :movement_id
|
4
|
+
|
5
|
+
def initialize(attrs = {})
|
6
|
+
super(attrs)
|
7
|
+
self.movement_id = client.connection.options[:movement_id] if client.present?
|
8
|
+
end
|
9
|
+
|
10
|
+
def normalized_base_path(path)
|
11
|
+
"api/movements/#{movement_id}/#{path}/"
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
data/spec/action_spec.rb
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
|
3
|
+
describe PorpoiseExternalActions::Action do
|
4
|
+
|
5
|
+
let(:client) { PorpoiseExternalActions::Client.new(host: 'test.com', username: 'controlshift', password: 'controlshift', movement_id: 'controlshift') }
|
6
|
+
subject { PorpoiseExternalActions::Action.new({client: client }) }
|
7
|
+
|
8
|
+
context 'with an http post' do
|
9
|
+
let(:request_path) { '/api/movements/controlshift/external_activity_events/' }
|
10
|
+
let(:request_body) { params }
|
11
|
+
let(:status) { 201 }
|
12
|
+
let(:body) {''}
|
13
|
+
|
14
|
+
let(:params) { { source: 'foo', role: 'signer', action_slug: "slug", action_language_iso: "en", activity: "action_taken", user: {email: 'foo@bar.com'}} }
|
15
|
+
|
16
|
+
before(:each) do
|
17
|
+
stub_post(request_path).with(body: request_body).to_return(:body => body, :status => status,
|
18
|
+
:headers => { content_type: "application/json; charset=utf-8"})
|
19
|
+
end
|
20
|
+
|
21
|
+
describe "creating actions" do
|
22
|
+
context 'post returns 500' do
|
23
|
+
let(:status) { 500 }
|
24
|
+
let(:body){ '{"error":"no_method_error"}' }
|
25
|
+
|
26
|
+
it 'should return an error hash when a remote exception occurs' do
|
27
|
+
lambda { subject.create(params) }.should raise_exception(PorpoiseExternalActions::PorpoiseException, 'no_method_error')
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
|
32
|
+
context 'post returns 201' do
|
33
|
+
let(:status) {201}
|
34
|
+
it 'should return true when a successful action is created' do
|
35
|
+
subject.create(params).class.should == Faraday::Response
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
context 'post returns a 422' do
|
40
|
+
let(:status) {422}
|
41
|
+
let(:body) { '{"email":["is invalid"]}' }
|
42
|
+
|
43
|
+
it 'should return a hash when a validation error occurs' do
|
44
|
+
lambda { subject.create(params) }.should raise_exception(PorpoiseExternalActions::PorpoiseInvalidException, 'validation error')
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
end
|
50
|
+
|
51
|
+
|
52
|
+
|
53
|
+
end
|
data/spec/client_spec.rb
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
|
3
|
+
describe PorpoiseExternalActions::Client do
|
4
|
+
|
5
|
+
describe "initialized" do
|
6
|
+
subject { described_class.new(options) }
|
7
|
+
let(:handlers) { subject.connection.stack.handlers }
|
8
|
+
|
9
|
+
|
10
|
+
context 'process_basic_auth' do
|
11
|
+
let(:options) { { :basic_auth => 'login:password' } }
|
12
|
+
let(:config) { subject.connection.configuration }
|
13
|
+
specify { config.username.should eq 'login' }
|
14
|
+
specify { config.password.should eq 'password' }
|
15
|
+
specify { handlers.should include(Vertebrae::Request::BasicAuth) }
|
16
|
+
end
|
17
|
+
|
18
|
+
context 'stack' do
|
19
|
+
let(:options) { {} }
|
20
|
+
specify { handlers.should include(Faraday::Request::UrlEncoded) }
|
21
|
+
specify { handlers.should include(PorpoiseExternalActions::ExceptionMiddleware) }
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
describe 'configure models' do
|
26
|
+
let(:client) { PorpoiseExternalActions.new(host: 'test.com', username: 'controlshift', password: 'controlshift', movement_id: 'controlshift') }
|
27
|
+
|
28
|
+
it 'should set the movement_id from the connection' do
|
29
|
+
client.action.movement_id.should == 'controlshift'
|
30
|
+
end
|
31
|
+
|
32
|
+
end
|
33
|
+
end
|
data/spec/model_spec.rb
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
|
2
|
+
|
3
|
+
describe PorpoiseExternalActions::Model do
|
4
|
+
|
5
|
+
it 'should normalize the base path' do
|
6
|
+
subject.stub(:movement_id).and_return('controlshift')
|
7
|
+
subject.normalized_base_path('foo').should == "api/movements/controlshift/foo/"
|
8
|
+
end
|
9
|
+
|
10
|
+
|
11
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
2
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
3
|
+
require 'rspec'
|
4
|
+
require 'webmock/rspec'
|
5
|
+
|
6
|
+
require 'porpoise_external_actions'
|
7
|
+
|
8
|
+
# Requires supporting files with custom matchers and macros, etc,
|
9
|
+
# in ./support/ and its subdirectories.
|
10
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}
|
11
|
+
|
12
|
+
RSpec.configure do |config|
|
13
|
+
config.color_enabled = true
|
14
|
+
config.include WebMock::API
|
15
|
+
|
16
|
+
config.before(:each) do
|
17
|
+
WebMock.reset!
|
18
|
+
end
|
19
|
+
config.after(:each) do
|
20
|
+
WebMock.reset!
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
def stub_get(path)
|
25
|
+
stub_porpoise_request(:get, path)
|
26
|
+
end
|
27
|
+
|
28
|
+
def stub_post(path)
|
29
|
+
stub_porpoise_request(:post, path)
|
30
|
+
end
|
31
|
+
|
32
|
+
def stub_porpoise_request(method, path)
|
33
|
+
stub_request(method, "https://controlshift:controlshift@test.com" + path)
|
34
|
+
end
|
35
|
+
|
36
|
+
|
37
|
+
def fixture_path
|
38
|
+
File.expand_path("../fixtures", __FILE__)
|
39
|
+
end
|
40
|
+
|
41
|
+
def fixture(file)
|
42
|
+
File.new(File.join(fixture_path, '/', file))
|
43
|
+
end
|
metadata
ADDED
@@ -0,0 +1,162 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: porpoise_external_actions
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Nathan Woodhull
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2013-09-16 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: vertebrae
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - '>='
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - '>='
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: webmock
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: pry
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: pry-debugger
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: bundler
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - '>='
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - '>='
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: jeweler
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ~>
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 1.8.4
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ~>
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 1.8.4
|
111
|
+
description: An API client for the Purpose Platform
|
112
|
+
email: nathan@controlshiftlabs.com
|
113
|
+
executables: []
|
114
|
+
extensions: []
|
115
|
+
extra_rdoc_files:
|
116
|
+
- LICENSE.txt
|
117
|
+
- README.md
|
118
|
+
files:
|
119
|
+
- .ruby-gemset
|
120
|
+
- .ruby-version
|
121
|
+
- .travis.yml
|
122
|
+
- Gemfile
|
123
|
+
- Gemfile.lock
|
124
|
+
- LICENSE.txt
|
125
|
+
- README.md
|
126
|
+
- Rakefile
|
127
|
+
- VERSION
|
128
|
+
- lib/porpoise_external_actions.rb
|
129
|
+
- lib/porpoise_external_actions/action.rb
|
130
|
+
- lib/porpoise_external_actions/client.rb
|
131
|
+
- lib/porpoise_external_actions/exception_middleware.rb
|
132
|
+
- lib/porpoise_external_actions/model.rb
|
133
|
+
- spec/action_spec.rb
|
134
|
+
- spec/client_spec.rb
|
135
|
+
- spec/model_spec.rb
|
136
|
+
- spec/porpoise_external_actions_spec.rb
|
137
|
+
- spec/spec_helper.rb
|
138
|
+
homepage: http://github.com/controlshift/porpoise_external_actions
|
139
|
+
licenses:
|
140
|
+
- MIT
|
141
|
+
metadata: {}
|
142
|
+
post_install_message:
|
143
|
+
rdoc_options: []
|
144
|
+
require_paths:
|
145
|
+
- lib
|
146
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
147
|
+
requirements:
|
148
|
+
- - '>='
|
149
|
+
- !ruby/object:Gem::Version
|
150
|
+
version: '0'
|
151
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
152
|
+
requirements:
|
153
|
+
- - '>='
|
154
|
+
- !ruby/object:Gem::Version
|
155
|
+
version: '0'
|
156
|
+
requirements: []
|
157
|
+
rubyforge_project:
|
158
|
+
rubygems_version: 2.0.7
|
159
|
+
signing_key:
|
160
|
+
specification_version: 4
|
161
|
+
summary: API client for Purpose Platform External Actions
|
162
|
+
test_files: []
|