hyperclient 0.3.2 → 0.4.0
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.
- checksums.yaml +4 -4
- data/Gemfile.lock +55 -39
- data/hyperclient.gemspec +1 -0
- data/lib/faraday/request/digest_authentication.rb +3 -1
- data/lib/hyperclient/link.rb +22 -7
- data/lib/hyperclient/version.rb +1 -1
- data/test/hyperclient/link_test.rb +11 -12
- data/test/test_helper.rb +1 -0
- metadata +16 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA1:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: b87fcd7112fdf8f2cbb75b3e70d9eb63ed7c4d93
|
|
4
|
+
data.tar.gz: fbbb826d826c93579534fbe028d3669192f524f7
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 05065d18d4c25d4c73c9e3023e3ab1710cb41a8750ee9ad4fef18deb69e08949492a2b67ad0a590170f39162c5ff8888b24b72b876d440c12ca4e1fdf98fd4fa
|
|
7
|
+
data.tar.gz: 33213521c2e8443cc70e4b48f6327dd83a58c9f016266d2af27f0774cd980b84bb69e98ad1733ffeadd446073a31014bbb2a822c81234d73eda345c247a3af81
|
data/Gemfile.lock
CHANGED
|
@@ -1,77 +1,93 @@
|
|
|
1
1
|
GIT
|
|
2
2
|
remote: git://github.com/rubyworks/yard-tomdoc
|
|
3
|
-
revision:
|
|
3
|
+
revision: e4b09dcd574718bda91d0f956b4dd83246bda273
|
|
4
4
|
specs:
|
|
5
|
-
yard-tomdoc (0.
|
|
6
|
-
tomparse
|
|
5
|
+
yard-tomdoc (0.7.1)
|
|
6
|
+
tomparse (>= 0.4.0)
|
|
7
7
|
yard
|
|
8
8
|
|
|
9
9
|
PATH
|
|
10
10
|
remote: .
|
|
11
11
|
specs:
|
|
12
|
-
hyperclient (0.
|
|
12
|
+
hyperclient (0.4.0)
|
|
13
13
|
faraday (~> 0.8)
|
|
14
14
|
faraday_middleware (~> 0.9)
|
|
15
|
+
futuroscope (>= 0.0.10)
|
|
15
16
|
net-http-digest_auth (~> 1.2)
|
|
16
17
|
uri_template (~> 0.5)
|
|
17
18
|
|
|
18
19
|
GEM
|
|
19
20
|
remote: https://rubygems.org/
|
|
20
21
|
specs:
|
|
21
|
-
addressable (2.
|
|
22
|
-
ansi (1.4.
|
|
23
|
-
coderay (1.0.
|
|
22
|
+
addressable (2.3.4)
|
|
23
|
+
ansi (1.4.3)
|
|
24
|
+
coderay (1.0.9)
|
|
24
25
|
colorize (0.5.8)
|
|
25
|
-
crack (0.3.
|
|
26
|
-
faraday (0.8.
|
|
26
|
+
crack (0.3.2)
|
|
27
|
+
faraday (0.8.9)
|
|
27
28
|
multipart-post (~> 1.2.0)
|
|
28
29
|
faraday_middleware (0.9.0)
|
|
29
30
|
faraday (>= 0.7.4, < 0.9)
|
|
30
|
-
ffi (1.
|
|
31
|
-
|
|
31
|
+
ffi (1.8.1)
|
|
32
|
+
formatador (0.2.4)
|
|
33
|
+
futuroscope (0.1.6)
|
|
34
|
+
gherkin-ruby (0.3.0)
|
|
32
35
|
growl (1.0.3)
|
|
33
|
-
guard (1.0
|
|
34
|
-
|
|
36
|
+
guard (1.8.0)
|
|
37
|
+
formatador (>= 0.2.4)
|
|
38
|
+
listen (>= 1.0.0)
|
|
39
|
+
lumberjack (>= 1.0.2)
|
|
40
|
+
pry (>= 0.9.10)
|
|
35
41
|
thor (>= 0.14.6)
|
|
36
42
|
guard-minitest (0.5.0)
|
|
37
43
|
guard (>= 0.4)
|
|
38
|
-
guard-spinach (0.0.
|
|
39
|
-
guard
|
|
44
|
+
guard-spinach (0.0.2)
|
|
45
|
+
guard (>= 1.1)
|
|
40
46
|
spinach
|
|
47
|
+
listen (1.0.3)
|
|
48
|
+
rb-fsevent (>= 0.9.3)
|
|
49
|
+
rb-inotify (>= 0.9)
|
|
50
|
+
rb-kqueue (>= 0.2)
|
|
51
|
+
lumberjack (1.0.3)
|
|
41
52
|
metaclass (0.0.1)
|
|
42
|
-
method_source (0.
|
|
53
|
+
method_source (0.8.1)
|
|
43
54
|
minitest (3.4.0)
|
|
44
|
-
mocha (0.13.
|
|
55
|
+
mocha (0.13.3)
|
|
45
56
|
metaclass (~> 0.0.1)
|
|
46
|
-
multi_json (1.
|
|
57
|
+
multi_json (1.7.2)
|
|
47
58
|
multipart-post (1.2.0)
|
|
48
|
-
net-http-digest_auth (1.
|
|
49
|
-
pry (0.9.
|
|
59
|
+
net-http-digest_auth (1.4)
|
|
60
|
+
pry (0.9.12.1)
|
|
50
61
|
coderay (~> 1.0.5)
|
|
51
|
-
method_source (~> 0.
|
|
52
|
-
slop (
|
|
53
|
-
rack (1.
|
|
62
|
+
method_source (~> 0.8)
|
|
63
|
+
slop (~> 3.4)
|
|
64
|
+
rack (1.5.2)
|
|
54
65
|
rack-test (0.6.2)
|
|
55
66
|
rack (>= 1.0)
|
|
56
|
-
rake (0.
|
|
57
|
-
|
|
58
|
-
|
|
67
|
+
rake (10.0.4)
|
|
68
|
+
rb-fsevent (0.9.3)
|
|
69
|
+
rb-inotify (0.9.0)
|
|
70
|
+
ffi (>= 0.5.0)
|
|
71
|
+
rb-kqueue (0.2.0)
|
|
72
|
+
ffi (>= 0.5.0)
|
|
73
|
+
redcarpet (2.2.2)
|
|
74
|
+
simplecov (0.7.1)
|
|
59
75
|
multi_json (~> 1.0)
|
|
60
|
-
simplecov-html (~> 0.
|
|
61
|
-
simplecov-html (0.
|
|
62
|
-
slop (
|
|
63
|
-
spinach (0.
|
|
64
|
-
colorize
|
|
65
|
-
gherkin-ruby (~> 0.
|
|
66
|
-
thor (0.
|
|
67
|
-
tomparse (0.2
|
|
68
|
-
turn (0.9.
|
|
76
|
+
simplecov-html (~> 0.7.1)
|
|
77
|
+
simplecov-html (0.7.1)
|
|
78
|
+
slop (3.4.4)
|
|
79
|
+
spinach (0.8.2)
|
|
80
|
+
colorize (= 0.5.8)
|
|
81
|
+
gherkin-ruby (~> 0.3.0)
|
|
82
|
+
thor (0.18.1)
|
|
83
|
+
tomparse (0.4.2)
|
|
84
|
+
turn (0.9.6)
|
|
69
85
|
ansi
|
|
70
|
-
uri_template (0.
|
|
71
|
-
webmock (1.
|
|
86
|
+
uri_template (0.7.0)
|
|
87
|
+
webmock (1.11.0)
|
|
72
88
|
addressable (>= 2.2.7)
|
|
73
|
-
crack (>= 0.
|
|
74
|
-
yard (0.8.
|
|
89
|
+
crack (>= 0.3.2)
|
|
90
|
+
yard (0.8.6.1)
|
|
75
91
|
|
|
76
92
|
PLATFORMS
|
|
77
93
|
ruby
|
data/hyperclient.gemspec
CHANGED
|
@@ -15,6 +15,7 @@ Gem::Specification.new do |gem|
|
|
|
15
15
|
gem.version = Hyperclient::VERSION
|
|
16
16
|
|
|
17
17
|
gem.add_dependency 'faraday', '~> 0.8'
|
|
18
|
+
gem.add_dependency 'futuroscope', '>= 0.0.10'
|
|
18
19
|
gem.add_dependency 'faraday_middleware', '~> 0.9'
|
|
19
20
|
gem.add_dependency 'uri_template', '~> 0.5'
|
|
20
21
|
gem.add_dependency 'net-http-digest_auth', '~> 1.2'
|
|
@@ -80,4 +80,6 @@ module Faraday
|
|
|
80
80
|
end
|
|
81
81
|
|
|
82
82
|
# Register the middleware as a Request middleware with the name :digest
|
|
83
|
-
Faraday
|
|
83
|
+
registry = [Faraday, Faraday::Middleware].find{|mod| mod.respond_to?(:register_middleware)}
|
|
84
|
+
raise "Could not find method register_middleware on Faraday or Faraday::Middleware" unless registry
|
|
85
|
+
registry.register_middleware :request, digest: Faraday::Request::DigestAuth
|
data/lib/hyperclient/link.rb
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
require 'hyperclient/resource'
|
|
2
2
|
require 'uri_template'
|
|
3
|
+
require 'futuroscope'
|
|
3
4
|
|
|
4
5
|
module Hyperclient
|
|
5
6
|
# Internal: The Link is used to let a Resource interact with the API.
|
|
@@ -100,31 +101,45 @@ module Hyperclient
|
|
|
100
101
|
end
|
|
101
102
|
|
|
102
103
|
def get
|
|
103
|
-
|
|
104
|
+
Futuroscope::Future.new{
|
|
105
|
+
connection.get(url)
|
|
106
|
+
}
|
|
104
107
|
end
|
|
105
108
|
|
|
106
109
|
def options
|
|
107
|
-
|
|
110
|
+
Futuroscope::Future.new{
|
|
111
|
+
connection.run_request(:options, url, nil, nil)
|
|
112
|
+
}
|
|
108
113
|
end
|
|
109
114
|
|
|
110
115
|
def head
|
|
111
|
-
|
|
116
|
+
Futuroscope::Future.new{
|
|
117
|
+
connection.head(url)
|
|
118
|
+
}
|
|
112
119
|
end
|
|
113
120
|
|
|
114
121
|
def delete
|
|
115
|
-
|
|
122
|
+
Futuroscope::Future.new{
|
|
123
|
+
connection.delete(url)
|
|
124
|
+
}
|
|
116
125
|
end
|
|
117
126
|
|
|
118
127
|
def post(params = {})
|
|
119
|
-
|
|
128
|
+
Futuroscope::Future.new{
|
|
129
|
+
connection.post(url, params)
|
|
130
|
+
}
|
|
120
131
|
end
|
|
121
132
|
|
|
122
133
|
def put(params = {})
|
|
123
|
-
|
|
134
|
+
Futuroscope::Future.new{
|
|
135
|
+
connection.put(url, params)
|
|
136
|
+
}
|
|
124
137
|
end
|
|
125
138
|
|
|
126
139
|
def patch(params = {})
|
|
127
|
-
|
|
140
|
+
Futuroscope::Future.new{
|
|
141
|
+
connection.patch(url, params)
|
|
142
|
+
}
|
|
128
143
|
end
|
|
129
144
|
|
|
130
145
|
def inspect
|
data/lib/hyperclient/version.rb
CHANGED
|
@@ -60,8 +60,7 @@ module Hyperclient
|
|
|
60
60
|
|
|
61
61
|
it 'raises if no uri variables are given' do
|
|
62
62
|
link = Link.new({'href' => '/orders{?id}', 'templated' => true}, entry_point)
|
|
63
|
-
|
|
64
|
-
proc { link.resource }.must_raise MissingURITemplateVariablesException
|
|
63
|
+
lambda { link.expand }.must_raise ArgumentError
|
|
65
64
|
end
|
|
66
65
|
end
|
|
67
66
|
|
|
@@ -119,7 +118,7 @@ module Hyperclient
|
|
|
119
118
|
link = Link.new({'href' => '/productions/1'}, entry_point)
|
|
120
119
|
|
|
121
120
|
entry_point.connection.expects(:get).with('/productions/1')
|
|
122
|
-
link.get
|
|
121
|
+
link.get.inspect
|
|
123
122
|
end
|
|
124
123
|
end
|
|
125
124
|
|
|
@@ -128,7 +127,7 @@ module Hyperclient
|
|
|
128
127
|
link = Link.new({'href' => '/productions/1'}, entry_point)
|
|
129
128
|
|
|
130
129
|
entry_point.connection.expects(:run_request).with(:options, '/productions/1', nil, nil)
|
|
131
|
-
link.options
|
|
130
|
+
link.options.inspect
|
|
132
131
|
end
|
|
133
132
|
end
|
|
134
133
|
|
|
@@ -137,7 +136,7 @@ module Hyperclient
|
|
|
137
136
|
link = Link.new({'href' => '/productions/1'}, entry_point)
|
|
138
137
|
|
|
139
138
|
entry_point.connection.expects(:head).with('/productions/1')
|
|
140
|
-
link.head
|
|
139
|
+
link.head.inspect
|
|
141
140
|
end
|
|
142
141
|
end
|
|
143
142
|
|
|
@@ -146,7 +145,7 @@ module Hyperclient
|
|
|
146
145
|
link = Link.new({'href' => '/productions/1'}, entry_point)
|
|
147
146
|
|
|
148
147
|
entry_point.connection.expects(:delete).with('/productions/1')
|
|
149
|
-
link.delete
|
|
148
|
+
link.delete.inspect
|
|
150
149
|
end
|
|
151
150
|
end
|
|
152
151
|
|
|
@@ -155,12 +154,12 @@ module Hyperclient
|
|
|
155
154
|
|
|
156
155
|
it 'sends a POST request with the link url and params' do
|
|
157
156
|
entry_point.connection.expects(:post).with('/productions/1', {'foo' => 'bar'})
|
|
158
|
-
link.post({'foo' => 'bar'})
|
|
157
|
+
link.post({'foo' => 'bar'}).inspect
|
|
159
158
|
end
|
|
160
159
|
|
|
161
160
|
it 'defaults params to an empty hash' do
|
|
162
161
|
entry_point.connection.expects(:post).with('/productions/1', {})
|
|
163
|
-
link.post
|
|
162
|
+
link.post.inspect
|
|
164
163
|
end
|
|
165
164
|
end
|
|
166
165
|
|
|
@@ -169,12 +168,12 @@ module Hyperclient
|
|
|
169
168
|
|
|
170
169
|
it 'sends a PUT request with the link url and params' do
|
|
171
170
|
entry_point.connection.expects(:put).with('/productions/1', {'foo' => 'bar'})
|
|
172
|
-
link.put({'foo' => 'bar'})
|
|
171
|
+
link.put({'foo' => 'bar'}).inspect
|
|
173
172
|
end
|
|
174
173
|
|
|
175
174
|
it 'defaults params to an empty hash' do
|
|
176
175
|
entry_point.connection.expects(:put).with('/productions/1', {})
|
|
177
|
-
link.put
|
|
176
|
+
link.put.inspect
|
|
178
177
|
end
|
|
179
178
|
end
|
|
180
179
|
|
|
@@ -183,12 +182,12 @@ module Hyperclient
|
|
|
183
182
|
|
|
184
183
|
it 'sends a PATCH request with the link url and params' do
|
|
185
184
|
entry_point.connection.expects(:patch).with('/productions/1', {'foo' => 'bar'})
|
|
186
|
-
link.patch({'foo' => 'bar'})
|
|
185
|
+
link.patch({'foo' => 'bar'}).inspect
|
|
187
186
|
end
|
|
188
187
|
|
|
189
188
|
it 'defaults params to an empty hash' do
|
|
190
189
|
entry_point.connection.expects(:patch).with('/productions/1', {})
|
|
191
|
-
link.patch
|
|
190
|
+
link.patch.inspect
|
|
192
191
|
end
|
|
193
192
|
end
|
|
194
193
|
|
data/test/test_helper.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: hyperclient
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.4.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Oriol Gual
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2014-05-05 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: faraday
|
|
@@ -24,6 +24,20 @@ dependencies:
|
|
|
24
24
|
- - "~>"
|
|
25
25
|
- !ruby/object:Gem::Version
|
|
26
26
|
version: '0.8'
|
|
27
|
+
- !ruby/object:Gem::Dependency
|
|
28
|
+
name: futuroscope
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - ">="
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: 0.0.10
|
|
34
|
+
type: :runtime
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - ">="
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: 0.0.10
|
|
27
41
|
- !ruby/object:Gem::Dependency
|
|
28
42
|
name: faraday_middleware
|
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|