hullio 0.3.2 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.gitignore +2 -0
- data/Gemfile +19 -1
- data/README.md +3 -0
- data/Rakefile +9 -2
- data/hullio.gemspec +2 -3
- data/lib/hull.rb +1 -1
- data/lib/hull/connection.rb +1 -3
- data/lib/hull/request.rb +10 -2
- data/lib/hull/version.rb +1 -1
- metadata +5 -4
data/.gitignore
CHANGED
data/Gemfile
CHANGED
@@ -1,4 +1,22 @@
|
|
1
1
|
source 'https://rubygems.org'
|
2
2
|
|
3
|
-
|
3
|
+
gem 'faraday', '0.8.9'
|
4
|
+
|
5
|
+
group :development, :test do
|
6
|
+
gem 'rake'
|
7
|
+
gem 'guard', '~> 2.6'
|
8
|
+
gem 'guard-rspec', '~> 4', require: false
|
9
|
+
gem 'typhoeus' unless defined? JRUBY_VERSION
|
10
|
+
gem 'pry-debugger'
|
11
|
+
end
|
12
|
+
|
13
|
+
group :test do
|
14
|
+
gem 'rspec', '~> 3.0'
|
15
|
+
gem 'webmock'
|
16
|
+
end
|
17
|
+
|
18
|
+
gem 'jruby-openssl' if defined? JRUBY_VERSION
|
19
|
+
|
4
20
|
gemspec
|
21
|
+
|
22
|
+
|
data/README.md
CHANGED
@@ -51,6 +51,9 @@ with Hull entities :
|
|
51
51
|
Hull.get('entity', { uid: 'http://example.com' })
|
52
52
|
Hull.put('entity', { uid: 'http://example.com', name: 'My super Page' })
|
53
53
|
Hull.delete('entity', { uid: 'http://example.com' })
|
54
|
+
|
55
|
+
# Get comments on the Entity identified by 'http://example.com'
|
56
|
+
Hull.get('entity/comments', { uid: 'http://example.com' })
|
54
57
|
```
|
55
58
|
|
56
59
|
### Making API calls as as a User
|
data/Rakefile
CHANGED
data/hullio.gemspec
CHANGED
@@ -16,12 +16,11 @@ Gem::Specification.new do |gem|
|
|
16
16
|
gem.version = Hull::VERSION
|
17
17
|
|
18
18
|
# Dependencies
|
19
|
-
gem.add_dependency 'faraday'
|
19
|
+
gem.add_dependency 'faraday', '>= 0.8'
|
20
20
|
gem.add_dependency 'faraday_middleware'
|
21
21
|
gem.add_dependency 'multi_json'
|
22
22
|
gem.add_dependency 'mime-types'
|
23
23
|
|
24
24
|
# Development Dependencies
|
25
|
-
gem.add_development_dependency 'activesupport',
|
26
|
-
|
25
|
+
gem.add_development_dependency 'activesupport', ['>= 2.3.9', '< 4']
|
27
26
|
end
|
data/lib/hull.rb
CHANGED
data/lib/hull/connection.rb
CHANGED
@@ -20,9 +20,7 @@ module Hull
|
|
20
20
|
},
|
21
21
|
:ssl => {:verify => false},
|
22
22
|
:url => options.fetch(:org_url, org_url),
|
23
|
-
:
|
24
|
-
:proxy => options.fetch(:proxy, proxy),
|
25
|
-
:open_timeout => 10
|
23
|
+
:proxy => options.fetch(:proxy, proxy)
|
26
24
|
}
|
27
25
|
@connection ||= Faraday.new(default_options.deep_merge(connection_options)) do |builder|
|
28
26
|
builder.use Hull::Request::Auth, credentials
|
data/lib/hull/request.rb
CHANGED
@@ -36,9 +36,17 @@ module Hull
|
|
36
36
|
|
37
37
|
# Perform an HTTP request
|
38
38
|
def request(method, path, params={}, options={})
|
39
|
-
Hull.log("#{method.upcase} #{path} - params: #{params.to_json}")
|
39
|
+
Hull.log("#{method.upcase} #{path} - params: #{params.to_json} - options: #{options.inspect}")
|
40
40
|
response = connection(options).run_request(method, nil, nil, nil) do |request|
|
41
|
-
|
41
|
+
|
42
|
+
if request.options.is_a?(Hash)
|
43
|
+
request.options[:timeout] ||= options.fetch(:timeout, 10)
|
44
|
+
request.options[:open_timeout] ||= options.fetch(:open_timeout, 10)
|
45
|
+
elsif request.options.respond_to?(:timeout)
|
46
|
+
request.options.timeout ||= options.fetch(:timeout, 10)
|
47
|
+
request.options.open_timeout ||= options.fetch(:open_timeout, 10)
|
48
|
+
end
|
49
|
+
|
42
50
|
case method.to_sym
|
43
51
|
when :delete, :get
|
44
52
|
request.url(path, params)
|
data/lib/hull/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hullio
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2014-
|
13
|
+
date: 2014-06-05 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: faraday
|
@@ -18,7 +18,7 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: '0'
|
21
|
+
version: '0.8'
|
22
22
|
none: false
|
23
23
|
prerelease: false
|
24
24
|
type: :runtime
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ! '>='
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: '0'
|
29
|
+
version: '0.8'
|
30
30
|
none: false
|
31
31
|
- !ruby/object:Gem::Dependency
|
32
32
|
name: faraday_middleware
|
@@ -148,3 +148,4 @@ signing_key:
|
|
148
148
|
specification_version: 3
|
149
149
|
summary: Hull Ruby Client
|
150
150
|
test_files: []
|
151
|
+
has_rdoc:
|