action_kit_rest 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +15 -0
- data/.document +5 -0
- data/.rspec +1 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +112 -0
- data/LICENSE.txt +24 -0
- data/README.md +23 -0
- data/Rakefile +50 -0
- data/VERSION +1 -0
- data/action_kit_rest.gemspec +107 -0
- data/lib/action_kit_rest.rb +30 -0
- data/lib/action_kit_rest/action.rb +7 -0
- data/lib/action_kit_rest/api.rb +53 -0
- data/lib/action_kit_rest/base.rb +37 -0
- data/lib/action_kit_rest/client.rb +35 -0
- data/lib/action_kit_rest/list.rb +12 -0
- data/lib/action_kit_rest/page.rb +11 -0
- data/lib/action_kit_rest/pages/base.rb +20 -0
- data/lib/action_kit_rest/pages/import_page.rb +9 -0
- data/lib/action_kit_rest/pages/signup_page.rb +9 -0
- data/lib/action_kit_rest/railties.rb +7 -0
- data/lib/action_kit_rest/response/collection.rb +25 -0
- data/lib/action_kit_rest/response/raise_error.rb +25 -0
- data/lib/action_kit_rest/response/validation_error.rb +19 -0
- data/lib/action_kit_rest/response/wrapper.rb +120 -0
- data/lib/action_kit_rest/tag.rb +20 -0
- data/lib/action_kit_rest/user.rb +7 -0
- data/lib/action_kit_rest/version.rb +10 -0
- data/spec/action_kit_rest/logger_spec.rb +20 -0
- data/spec/action_kit_rest/page_spec.rb +87 -0
- data/spec/action_kit_rest/pages/input_page_spec.rb +55 -0
- data/spec/action_kit_rest/user_spec.rb +32 -0
- data/spec/fixtures/error.json +1 -0
- data/spec/fixtures/page/collection.json +984 -0
- data/spec/fixtures/page/object.json +18 -0
- data/spec/fixtures/user/object.json +1 -0
- data/spec/spec_helper.rb +43 -0
- metadata +237 -0
checksums.yaml
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
---
|
2
|
+
!binary "U0hBMQ==":
|
3
|
+
metadata.gz: !binary |-
|
4
|
+
MTE1ZjRkMmQxNzE3ZjNhYTk0ZDMwMjg0OGI5OThhODBjMjdiMzBkMQ==
|
5
|
+
data.tar.gz: !binary |-
|
6
|
+
YTZjNzQ1N2EwNDg4N2ZiNDYxMTk4YjJlYWM2YTJiZDYzMTUwMjRjMg==
|
7
|
+
!binary "U0hBNTEy":
|
8
|
+
metadata.gz: !binary |-
|
9
|
+
YjI4YzVlNWM0YzJlNDA1OWFhY2EyNjQ3YjgzZmY5NjUyYmQ4YTM2ZDYzNzQz
|
10
|
+
NDIwYzBlZGRhMzY1NDNkZWYwZTg2ZjIxZmFmNzk2OGM0ZWVmMWRjMTJkNmFl
|
11
|
+
M2Y5NjRhMGY3MDk3ZWM0NjgxNWU4MjY2N2Y0YTVmNjBlNjBhMzc=
|
12
|
+
data.tar.gz: !binary |-
|
13
|
+
YTdjYzIwODBlYjQ5YWU1M2Y0MzBjN2U1NTFmNzVlYWJkNzRmOWY2NDFiNGYx
|
14
|
+
ZWFiYjI4YzIyOGExMmIwYmUwM2I2Yzk0MDA1MWNlNzU0NjVhMGViZWFlZTU3
|
15
|
+
ZDVlMmEwMjA1YmY1M2U2MjcyM2M2YjIyOTU0MDI1NDMzNjEyODM=
|
data/.document
ADDED
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--colour
|
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
action_kit_rest
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby-1.9.3-p286-perf
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,112 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
action_kit_rest (0.1.1)
|
5
|
+
action_kit_rest
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: http://rubygems.org/
|
9
|
+
specs:
|
10
|
+
addressable (2.3.3)
|
11
|
+
builder (3.2.2)
|
12
|
+
coderay (1.0.9)
|
13
|
+
columnize (0.3.6)
|
14
|
+
crack (0.3.2)
|
15
|
+
debugger (1.4.0)
|
16
|
+
columnize (>= 0.3.1)
|
17
|
+
debugger-linecache (~> 1.1.1)
|
18
|
+
debugger-ruby_core_source (~> 1.2.0)
|
19
|
+
debugger-linecache (1.1.2)
|
20
|
+
debugger-ruby_core_source (>= 1.1.1)
|
21
|
+
debugger-ruby_core_source (1.2.0)
|
22
|
+
diff-lcs (1.2.1)
|
23
|
+
faraday (0.8.8)
|
24
|
+
multipart-post (~> 1.2.0)
|
25
|
+
git (1.2.6)
|
26
|
+
github_api (0.10.1)
|
27
|
+
addressable
|
28
|
+
faraday (~> 0.8.1)
|
29
|
+
hashie (>= 1.2)
|
30
|
+
multi_json (~> 1.4)
|
31
|
+
nokogiri (~> 1.5.2)
|
32
|
+
oauth2
|
33
|
+
guard (1.6.2)
|
34
|
+
listen (>= 0.6.0)
|
35
|
+
lumberjack (>= 1.0.2)
|
36
|
+
pry (>= 0.9.10)
|
37
|
+
terminal-table (>= 1.4.3)
|
38
|
+
thor (>= 0.14.6)
|
39
|
+
guard-rspec (2.5.0)
|
40
|
+
guard (>= 1.1)
|
41
|
+
rspec (~> 2.11)
|
42
|
+
hashie (2.0.5)
|
43
|
+
highline (1.6.19)
|
44
|
+
httpauth (0.2.0)
|
45
|
+
jeweler (1.8.7)
|
46
|
+
builder
|
47
|
+
bundler (~> 1.0)
|
48
|
+
git (>= 1.2.5)
|
49
|
+
github_api (= 0.10.1)
|
50
|
+
highline (>= 1.6.15)
|
51
|
+
nokogiri (= 1.5.10)
|
52
|
+
rake
|
53
|
+
rdoc
|
54
|
+
json (1.8.0)
|
55
|
+
jwt (0.1.8)
|
56
|
+
multi_json (>= 1.5)
|
57
|
+
listen (0.7.3)
|
58
|
+
lumberjack (1.0.2)
|
59
|
+
method_source (0.8.1)
|
60
|
+
multi_json (1.8.0)
|
61
|
+
multi_xml (0.5.5)
|
62
|
+
multipart-post (1.2.0)
|
63
|
+
nokogiri (1.5.10)
|
64
|
+
oauth2 (0.9.2)
|
65
|
+
faraday (~> 0.8)
|
66
|
+
httpauth (~> 0.2)
|
67
|
+
jwt (~> 0.1.4)
|
68
|
+
multi_json (~> 1.0)
|
69
|
+
multi_xml (~> 0.5)
|
70
|
+
rack (~> 1.2)
|
71
|
+
pry (0.9.12)
|
72
|
+
coderay (~> 1.0.5)
|
73
|
+
method_source (~> 0.8)
|
74
|
+
slop (~> 3.4)
|
75
|
+
pry-debugger (0.2.2)
|
76
|
+
debugger (~> 1.3)
|
77
|
+
pry (~> 0.9.10)
|
78
|
+
rack (1.5.2)
|
79
|
+
rake (10.1.0)
|
80
|
+
rb-fsevent (0.9.3)
|
81
|
+
rdoc (4.0.1)
|
82
|
+
json (~> 1.4)
|
83
|
+
rspec (2.13.0)
|
84
|
+
rspec-core (~> 2.13.0)
|
85
|
+
rspec-expectations (~> 2.13.0)
|
86
|
+
rspec-mocks (~> 2.13.0)
|
87
|
+
rspec-core (2.13.1)
|
88
|
+
rspec-expectations (2.13.0)
|
89
|
+
diff-lcs (>= 1.1.3, < 2.0)
|
90
|
+
rspec-mocks (2.13.0)
|
91
|
+
slop (3.4.4)
|
92
|
+
terminal-table (1.4.5)
|
93
|
+
thor (0.17.0)
|
94
|
+
webmock (1.11.0)
|
95
|
+
addressable (>= 2.2.7)
|
96
|
+
crack (>= 0.3.2)
|
97
|
+
|
98
|
+
PLATFORMS
|
99
|
+
ruby
|
100
|
+
|
101
|
+
DEPENDENCIES
|
102
|
+
action_kit_rest!
|
103
|
+
bundler
|
104
|
+
guard
|
105
|
+
guard-rspec
|
106
|
+
jeweler (~> 1.8.4)
|
107
|
+
pry
|
108
|
+
pry-debugger
|
109
|
+
rb-fsevent
|
110
|
+
rdoc
|
111
|
+
rspec
|
112
|
+
webmock
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
Copyright (c) 2013, ControlShift, Ltd.
|
2
|
+
All rights reserved.
|
3
|
+
|
4
|
+
Redistribution and use in source and binary forms, with or without
|
5
|
+
modification, are permitted provided that the following conditions are met:
|
6
|
+
* Redistributions of source code must retain the above copyright
|
7
|
+
notice, this list of conditions and the following disclaimer.
|
8
|
+
* Redistributions in binary form must reproduce the above copyright
|
9
|
+
notice, this list of conditions and the following disclaimer in the
|
10
|
+
documentation and/or other materials provided with the distribution.
|
11
|
+
* Neither the name of the ControlShift, Ltd. nor the
|
12
|
+
names of its contributors may be used to endorse or promote products
|
13
|
+
derived from this software without specific prior written permission.
|
14
|
+
|
15
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
|
16
|
+
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
17
|
+
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
18
|
+
DISCLAIMED. IN NO EVENT SHALL CONTROLSHIFT LTD. BE LIABLE FOR ANY
|
19
|
+
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
20
|
+
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
21
|
+
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
22
|
+
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
23
|
+
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
24
|
+
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
data/README.md
ADDED
@@ -0,0 +1,23 @@
|
|
1
|
+
# action_kit_rest
|
2
|
+
|
3
|
+
A ruby binding for the ActionKit REST API
|
4
|
+
|
5
|
+
## Usage
|
6
|
+
|
7
|
+
```ruby
|
8
|
+
|
9
|
+
ak = ActionKitRest.new(host: 'roboticdogs.actionkit.com', username: 'name', password: 'pass')
|
10
|
+
ak.import_page.create(title: "Title", name: "name")
|
11
|
+
ak.import_page.list.each do | page |
|
12
|
+
puts page.name
|
13
|
+
end
|
14
|
+
|
15
|
+
```
|
16
|
+
|
17
|
+
This is very experimental still, but starting to be usable.
|
18
|
+
|
19
|
+
## Copyright
|
20
|
+
|
21
|
+
Copyright (c) 2013 ControlShift Ltd. See LICENSE.txt for
|
22
|
+
further details.
|
23
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,50 @@
|
|
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
|
+
require './lib/action_kit_rest/version.rb'
|
16
|
+
|
17
|
+
Jeweler::Tasks.new do |gem|
|
18
|
+
# gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
|
19
|
+
gem.name = "action_kit_rest"
|
20
|
+
gem.version = ActionKitRest::VERSION::STRING
|
21
|
+
gem.homepage = "http://github.com/controlshift/action_kit_rest"
|
22
|
+
gem.license = "MIT"
|
23
|
+
gem.summary = %Q{A wrapper for the ActionKit REST API}
|
24
|
+
gem.description = %Q{Gem for interacting with the ActionKit API}
|
25
|
+
gem.email = "woodhull@gmail.com"
|
26
|
+
gem.authors = ["Nathan Woodhull"]
|
27
|
+
# dependencies defined in Gemfile
|
28
|
+
end
|
29
|
+
Jeweler::RubygemsDotOrgTasks.new
|
30
|
+
|
31
|
+
|
32
|
+
require 'rspec/core/rake_task'
|
33
|
+
desc 'Default: run specs.'
|
34
|
+
task :default => :spec
|
35
|
+
|
36
|
+
desc "Run specs"
|
37
|
+
RSpec::Core::RakeTask.new do |t|
|
38
|
+
t.pattern = "./spec/**/*_spec.rb" # don't need this, it's default.
|
39
|
+
t.rspec_opts = '--color'
|
40
|
+
end
|
41
|
+
|
42
|
+
require 'rdoc/task'
|
43
|
+
Rake::RDocTask.new do |rdoc|
|
44
|
+
version = File.exist?('VERSION') ? File.read('VERSION') : ""
|
45
|
+
|
46
|
+
rdoc.rdoc_dir = 'rdoc'
|
47
|
+
rdoc.title = "action_kit_rest #{version}"
|
48
|
+
rdoc.rdoc_files.include('README*')
|
49
|
+
rdoc.rdoc_files.include('lib/**/*.rb')
|
50
|
+
end
|
data/VERSION
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
0.1.0
|
@@ -0,0 +1,107 @@
|
|
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 = "action_kit_rest"
|
8
|
+
s.version = "0.1.1"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Nathan Woodhull"]
|
12
|
+
s.date = "2013-10-03"
|
13
|
+
s.description = "Gem for interacting with the ActionKit API"
|
14
|
+
s.email = "woodhull@gmail.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
|
+
"action_kit_rest.gemspec",
|
31
|
+
"lib/action_kit_rest.rb",
|
32
|
+
"lib/action_kit_rest/action.rb",
|
33
|
+
"lib/action_kit_rest/api.rb",
|
34
|
+
"lib/action_kit_rest/base.rb",
|
35
|
+
"lib/action_kit_rest/client.rb",
|
36
|
+
"lib/action_kit_rest/list.rb",
|
37
|
+
"lib/action_kit_rest/page.rb",
|
38
|
+
"lib/action_kit_rest/pages/base.rb",
|
39
|
+
"lib/action_kit_rest/pages/import_page.rb",
|
40
|
+
"lib/action_kit_rest/pages/signup_page.rb",
|
41
|
+
"lib/action_kit_rest/railties.rb",
|
42
|
+
"lib/action_kit_rest/response/collection.rb",
|
43
|
+
"lib/action_kit_rest/response/raise_error.rb",
|
44
|
+
"lib/action_kit_rest/response/validation_error.rb",
|
45
|
+
"lib/action_kit_rest/response/wrapper.rb",
|
46
|
+
"lib/action_kit_rest/tag.rb",
|
47
|
+
"lib/action_kit_rest/user.rb",
|
48
|
+
"lib/action_kit_rest/version.rb",
|
49
|
+
"spec/action_kit_rest/logger_spec.rb",
|
50
|
+
"spec/action_kit_rest/page_spec.rb",
|
51
|
+
"spec/action_kit_rest/pages/input_page_spec.rb",
|
52
|
+
"spec/action_kit_rest/user_spec.rb",
|
53
|
+
"spec/fixtures/error.json",
|
54
|
+
"spec/fixtures/page/collection.json",
|
55
|
+
"spec/fixtures/page/object.json",
|
56
|
+
"spec/fixtures/user/object.json",
|
57
|
+
"spec/spec_helper.rb"
|
58
|
+
]
|
59
|
+
s.homepage = "http://github.com/controlshift/action_kit_rest"
|
60
|
+
s.licenses = ["MIT"]
|
61
|
+
s.require_paths = ["lib"]
|
62
|
+
s.rubygems_version = "2.0.7"
|
63
|
+
s.summary = "A wrapper for the ActionKit REST API"
|
64
|
+
|
65
|
+
if s.respond_to? :specification_version then
|
66
|
+
s.specification_version = 4
|
67
|
+
|
68
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
69
|
+
s.add_runtime_dependency(%q<action_kit_rest>, [">= 0"])
|
70
|
+
s.add_development_dependency(%q<rspec>, [">= 0"])
|
71
|
+
s.add_development_dependency(%q<guard>, [">= 0"])
|
72
|
+
s.add_development_dependency(%q<guard-rspec>, [">= 0"])
|
73
|
+
s.add_development_dependency(%q<pry>, [">= 0"])
|
74
|
+
s.add_development_dependency(%q<pry-debugger>, [">= 0"])
|
75
|
+
s.add_development_dependency(%q<rb-fsevent>, [">= 0"])
|
76
|
+
s.add_development_dependency(%q<rdoc>, [">= 0"])
|
77
|
+
s.add_development_dependency(%q<bundler>, [">= 0"])
|
78
|
+
s.add_development_dependency(%q<webmock>, [">= 0"])
|
79
|
+
s.add_development_dependency(%q<jeweler>, ["~> 1.8.4"])
|
80
|
+
else
|
81
|
+
s.add_dependency(%q<action_kit_rest>, [">= 0"])
|
82
|
+
s.add_dependency(%q<rspec>, [">= 0"])
|
83
|
+
s.add_dependency(%q<guard>, [">= 0"])
|
84
|
+
s.add_dependency(%q<guard-rspec>, [">= 0"])
|
85
|
+
s.add_dependency(%q<pry>, [">= 0"])
|
86
|
+
s.add_dependency(%q<pry-debugger>, [">= 0"])
|
87
|
+
s.add_dependency(%q<rb-fsevent>, [">= 0"])
|
88
|
+
s.add_dependency(%q<rdoc>, [">= 0"])
|
89
|
+
s.add_dependency(%q<bundler>, [">= 0"])
|
90
|
+
s.add_dependency(%q<webmock>, [">= 0"])
|
91
|
+
s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
|
92
|
+
end
|
93
|
+
else
|
94
|
+
s.add_dependency(%q<action_kit_rest>, [">= 0"])
|
95
|
+
s.add_dependency(%q<rspec>, [">= 0"])
|
96
|
+
s.add_dependency(%q<guard>, [">= 0"])
|
97
|
+
s.add_dependency(%q<guard-rspec>, [">= 0"])
|
98
|
+
s.add_dependency(%q<pry>, [">= 0"])
|
99
|
+
s.add_dependency(%q<pry-debugger>, [">= 0"])
|
100
|
+
s.add_dependency(%q<rb-fsevent>, [">= 0"])
|
101
|
+
s.add_dependency(%q<rdoc>, [">= 0"])
|
102
|
+
s.add_dependency(%q<bundler>, [">= 0"])
|
103
|
+
s.add_dependency(%q<webmock>, [">= 0"])
|
104
|
+
s.add_dependency(%q<jeweler>, ["~> 1.8.4"])
|
105
|
+
end
|
106
|
+
end
|
107
|
+
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'vertebrae'
|
2
|
+
|
3
|
+
module ActionKitRest
|
4
|
+
extend Vertebrae::Base
|
5
|
+
|
6
|
+
class << self
|
7
|
+
def new(options = {})
|
8
|
+
ActionKitRest::Client.new(options)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
require 'action_kit_rest/version'
|
14
|
+
require 'action_kit_rest/client'
|
15
|
+
require 'action_kit_rest/page'
|
16
|
+
require 'action_kit_rest/base'
|
17
|
+
require 'action_kit_rest/list'
|
18
|
+
require 'action_kit_rest/action'
|
19
|
+
require 'action_kit_rest/user'
|
20
|
+
require 'action_kit_rest/tag'
|
21
|
+
require 'action_kit_rest/pages/base'
|
22
|
+
require 'action_kit_rest/pages/import_page'
|
23
|
+
require 'action_kit_rest/pages/signup_page'
|
24
|
+
require 'action_kit_rest/response/wrapper'
|
25
|
+
require 'action_kit_rest/response/raise_error'
|
26
|
+
require 'action_kit_rest/response/validation_error'
|
27
|
+
require 'action_kit_rest/response/collection'
|
28
|
+
require 'active_support/all'
|
29
|
+
|
30
|
+
require 'action_kit_rest/railties' if defined? Rails
|
@@ -0,0 +1,53 @@
|
|
1
|
+
module ActionKitRest
|
2
|
+
class API < Vertebrae::API
|
3
|
+
|
4
|
+
def request_with_wrapper( *args )
|
5
|
+
ActionKitRest::Response::Wrapper.new( request_without_wrapper( *args ) )
|
6
|
+
end
|
7
|
+
alias_method_chain :request, :wrapper
|
8
|
+
|
9
|
+
def post_json_request(path, params)
|
10
|
+
p = {}
|
11
|
+
p['data'] = params.to_json
|
12
|
+
post_request(path, p)
|
13
|
+
end
|
14
|
+
|
15
|
+
def put_json_request(path, params)
|
16
|
+
p = {}
|
17
|
+
p['data'] = params.to_json
|
18
|
+
put_request(path, p)
|
19
|
+
end
|
20
|
+
|
21
|
+
def extract_data_from_params(params) # :nodoc:
|
22
|
+
if params.has_key?('data') && params['data'].present?
|
23
|
+
return params['data']
|
24
|
+
else
|
25
|
+
return params
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def default_options
|
30
|
+
{
|
31
|
+
user_agent: 'ActionKitRestGem',
|
32
|
+
prefix: '/rest/v1/',
|
33
|
+
content_type: 'application/json; charset=utf-8'
|
34
|
+
}
|
35
|
+
end
|
36
|
+
|
37
|
+
def setup
|
38
|
+
connection.stack do |builder|
|
39
|
+
builder.use Faraday::Request::Multipart
|
40
|
+
builder.use Faraday::Request::UrlEncoded
|
41
|
+
builder.use Vertebrae::Request::BasicAuth, connection.configuration.authentication if connection.configuration.authenticated?
|
42
|
+
|
43
|
+
builder.use Faraday::Response::Logger if ENV['DEBUG']
|
44
|
+
|
45
|
+
builder.use FaradayMiddleware::Mashify
|
46
|
+
builder.use FaradayMiddleware::ParseJson
|
47
|
+
|
48
|
+
builder.use ActionKitRest::Response::RaiseError
|
49
|
+
builder.adapter connection.configuration.adapter
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|