ddy_remote_resource 0.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +22 -0
- data/.rspec +2 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/.travis.yml +3 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +182 -0
- data/Rakefile +7 -0
- data/lib/extensions/ethon/easy/queryable.rb +36 -0
- data/lib/remote_resource.rb +64 -0
- data/lib/remote_resource/base.rb +126 -0
- data/lib/remote_resource/builder.rb +53 -0
- data/lib/remote_resource/collection.rb +31 -0
- data/lib/remote_resource/connection.rb +24 -0
- data/lib/remote_resource/connection_options.rb +41 -0
- data/lib/remote_resource/http_errors.rb +33 -0
- data/lib/remote_resource/querying/finder_methods.rb +34 -0
- data/lib/remote_resource/querying/persistence_methods.rb +38 -0
- data/lib/remote_resource/request.rb +106 -0
- data/lib/remote_resource/response.rb +69 -0
- data/lib/remote_resource/response_handeling.rb +48 -0
- data/lib/remote_resource/rest.rb +29 -0
- data/lib/remote_resource/url_naming.rb +34 -0
- data/lib/remote_resource/url_naming_determination.rb +39 -0
- data/lib/remote_resource/version.rb +3 -0
- data/remote_resource.gemspec +32 -0
- data/spec/lib/extensions/ethon/easy/queryable_spec.rb +135 -0
- data/spec/lib/remote_resource/base_spec.rb +388 -0
- data/spec/lib/remote_resource/builder_spec.rb +245 -0
- data/spec/lib/remote_resource/collection_spec.rb +148 -0
- data/spec/lib/remote_resource/connection_options_spec.rb +124 -0
- data/spec/lib/remote_resource/connection_spec.rb +61 -0
- data/spec/lib/remote_resource/querying/finder_methods_spec.rb +105 -0
- data/spec/lib/remote_resource/querying/persistence_methods_spec.rb +174 -0
- data/spec/lib/remote_resource/request_spec.rb +594 -0
- data/spec/lib/remote_resource/response_spec.rb +196 -0
- data/spec/lib/remote_resource/rest_spec.rb +98 -0
- data/spec/lib/remote_resource/url_naming_determination_spec.rb +225 -0
- data/spec/lib/remote_resource/url_naming_spec.rb +72 -0
- data/spec/lib/remote_resource/version_spec.rb +8 -0
- data/spec/spec_helper.rb +4 -0
- metadata +242 -0
@@ -0,0 +1,72 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe RemoteResource::UrlNaming do
|
4
|
+
|
5
|
+
module RemoteResource
|
6
|
+
class UrlNamingDummy
|
7
|
+
include RemoteResource::Base
|
8
|
+
|
9
|
+
self.site = 'https://foobar.com'
|
10
|
+
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
let(:dummy_class) { RemoteResource::UrlNamingDummy }
|
15
|
+
let(:dummy) { dummy_class.new }
|
16
|
+
|
17
|
+
describe '.collection' do
|
18
|
+
let!(:original_collection) { dummy_class.collection }
|
19
|
+
|
20
|
+
context 'when collection is set' do
|
21
|
+
it 'returns the given collection' do
|
22
|
+
dummy_class.collection = true
|
23
|
+
|
24
|
+
expect(dummy_class.collection).to eql true
|
25
|
+
|
26
|
+
dummy_class.collection = original_collection
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
context 'when NO collection is set' do
|
31
|
+
it 'returns the default collection' do
|
32
|
+
expect(dummy_class.collection).to eql false
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
describe '.app_host' do
|
38
|
+
context 'when the env is given as an argument' do
|
39
|
+
it 'uses the host specified in the CONFIG constant for the given env' do
|
40
|
+
stub_const("CONFIG", { test: { apps: { dummy: 'https://foobar.test.com' } } })
|
41
|
+
|
42
|
+
expect(dummy_class.app_host 'dummy', 'test').to eql 'https://foobar.test.com'
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
context 'when the env is NOT given as an argument' do
|
47
|
+
it 'uses the host specified in the CONFIG constant for the development env' do
|
48
|
+
stub_const("CONFIG", { development: { apps: { dummy: 'https://foobar.development.com' } } })
|
49
|
+
|
50
|
+
expect(dummy_class.app_host 'dummy').to eql 'https://foobar.development.com'
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
describe '.base_url' do
|
56
|
+
it 'uses the RemoteResource::UrlNamingDetermination class to determine the base_url' do
|
57
|
+
expect(RemoteResource::UrlNamingDetermination).to receive(:new).with(dummy_class).and_call_original
|
58
|
+
dummy_class.base_url
|
59
|
+
end
|
60
|
+
|
61
|
+
it 'returns the determined base_url' do
|
62
|
+
expect(dummy_class.base_url).to eql 'https://foobar.com/url_naming_dummy'
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
describe '.use_relative_model_naming?' do
|
67
|
+
it 'returns true' do
|
68
|
+
expect(dummy_class.use_relative_model_naming?).to eql true
|
69
|
+
end
|
70
|
+
end
|
71
|
+
|
72
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,242 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: ddy_remote_resource
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.4.2
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Jan van der Pas
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-12-12 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.6'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.6'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
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: rspec
|
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
|
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: activesupport
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
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: activemodel
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :runtime
|
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: virtus
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: mime-types
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '1.16'
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '1.16'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: ethon
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: 0.7.1
|
132
|
+
type: :runtime
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: 0.7.1
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: typhoeus
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
type: :runtime
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
153
|
+
description: RemoteResource, a gem to use resources with REST services. A replacement
|
154
|
+
for ActiveResource gem.
|
155
|
+
email:
|
156
|
+
- jvanderpas@digidentity.eu
|
157
|
+
executables: []
|
158
|
+
extensions: []
|
159
|
+
extra_rdoc_files: []
|
160
|
+
files:
|
161
|
+
- ".gitignore"
|
162
|
+
- ".rspec"
|
163
|
+
- ".ruby-gemset"
|
164
|
+
- ".ruby-version"
|
165
|
+
- ".travis.yml"
|
166
|
+
- Gemfile
|
167
|
+
- LICENSE.txt
|
168
|
+
- README.md
|
169
|
+
- Rakefile
|
170
|
+
- lib/extensions/ethon/easy/queryable.rb
|
171
|
+
- lib/remote_resource.rb
|
172
|
+
- lib/remote_resource/base.rb
|
173
|
+
- lib/remote_resource/builder.rb
|
174
|
+
- lib/remote_resource/collection.rb
|
175
|
+
- lib/remote_resource/connection.rb
|
176
|
+
- lib/remote_resource/connection_options.rb
|
177
|
+
- lib/remote_resource/http_errors.rb
|
178
|
+
- lib/remote_resource/querying/finder_methods.rb
|
179
|
+
- lib/remote_resource/querying/persistence_methods.rb
|
180
|
+
- lib/remote_resource/request.rb
|
181
|
+
- lib/remote_resource/response.rb
|
182
|
+
- lib/remote_resource/response_handeling.rb
|
183
|
+
- lib/remote_resource/rest.rb
|
184
|
+
- lib/remote_resource/url_naming.rb
|
185
|
+
- lib/remote_resource/url_naming_determination.rb
|
186
|
+
- lib/remote_resource/version.rb
|
187
|
+
- remote_resource.gemspec
|
188
|
+
- spec/lib/extensions/ethon/easy/queryable_spec.rb
|
189
|
+
- spec/lib/remote_resource/base_spec.rb
|
190
|
+
- spec/lib/remote_resource/builder_spec.rb
|
191
|
+
- spec/lib/remote_resource/collection_spec.rb
|
192
|
+
- spec/lib/remote_resource/connection_options_spec.rb
|
193
|
+
- spec/lib/remote_resource/connection_spec.rb
|
194
|
+
- spec/lib/remote_resource/querying/finder_methods_spec.rb
|
195
|
+
- spec/lib/remote_resource/querying/persistence_methods_spec.rb
|
196
|
+
- spec/lib/remote_resource/request_spec.rb
|
197
|
+
- spec/lib/remote_resource/response_spec.rb
|
198
|
+
- spec/lib/remote_resource/rest_spec.rb
|
199
|
+
- spec/lib/remote_resource/url_naming_determination_spec.rb
|
200
|
+
- spec/lib/remote_resource/url_naming_spec.rb
|
201
|
+
- spec/lib/remote_resource/version_spec.rb
|
202
|
+
- spec/spec_helper.rb
|
203
|
+
homepage: ''
|
204
|
+
licenses:
|
205
|
+
- MIT
|
206
|
+
metadata: {}
|
207
|
+
post_install_message:
|
208
|
+
rdoc_options: []
|
209
|
+
require_paths:
|
210
|
+
- lib
|
211
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
212
|
+
requirements:
|
213
|
+
- - ">="
|
214
|
+
- !ruby/object:Gem::Version
|
215
|
+
version: '0'
|
216
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
217
|
+
requirements:
|
218
|
+
- - ">="
|
219
|
+
- !ruby/object:Gem::Version
|
220
|
+
version: '0'
|
221
|
+
requirements: []
|
222
|
+
rubyforge_project:
|
223
|
+
rubygems_version: 2.2.2
|
224
|
+
signing_key:
|
225
|
+
specification_version: 4
|
226
|
+
summary: RemoteResource, a gem to use resources with REST services.
|
227
|
+
test_files:
|
228
|
+
- spec/lib/extensions/ethon/easy/queryable_spec.rb
|
229
|
+
- spec/lib/remote_resource/base_spec.rb
|
230
|
+
- spec/lib/remote_resource/builder_spec.rb
|
231
|
+
- spec/lib/remote_resource/collection_spec.rb
|
232
|
+
- spec/lib/remote_resource/connection_options_spec.rb
|
233
|
+
- spec/lib/remote_resource/connection_spec.rb
|
234
|
+
- spec/lib/remote_resource/querying/finder_methods_spec.rb
|
235
|
+
- spec/lib/remote_resource/querying/persistence_methods_spec.rb
|
236
|
+
- spec/lib/remote_resource/request_spec.rb
|
237
|
+
- spec/lib/remote_resource/response_spec.rb
|
238
|
+
- spec/lib/remote_resource/rest_spec.rb
|
239
|
+
- spec/lib/remote_resource/url_naming_determination_spec.rb
|
240
|
+
- spec/lib/remote_resource/url_naming_spec.rb
|
241
|
+
- spec/lib/remote_resource/version_spec.rb
|
242
|
+
- spec/spec_helper.rb
|