locomotivecms_coal 1.0.0.pre.beta.2 → 1.0.0.rc1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rspec +1 -1
- data/.travis.yml +1 -1
- data/Gemfile +1 -1
- data/Gemfile.lock +21 -18
- data/lib/locomotive/coal/client.rb +3 -3
- data/lib/locomotive/coal/resources/concerns/request.rb +1 -1
- data/lib/locomotive/coal/version.rb +1 -1
- data/locomotivecms_coal.gemspec +1 -1
- data/spec/fixtures/coal_cassettes/client.yml +35 -0
- data/spec/unit/client_spec.rb +34 -7
- data/spec/unit/client_v2_spec.rb +22 -0
- metadata +6 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aff31f15a22c2acfc6143964f04adc305cb78866
|
4
|
+
data.tar.gz: d4a4f954933fe0f8df28cc07a6ce2d4a2809a83a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd1eda0840c268ca473156602d10d7a3cd7c5b1823e3f9312bc8ca9b1dc3b766e7851bad8e304645e6c69c564316abe3bdaeaec6770df4bc2785cd0eb6e6d1a6
|
7
|
+
data.tar.gz: 3cec4549cf778fdc345b1ffbd3ea95a8ef7091a7732ce86270ebcb96efed470c3b726b083ff82b0d60f14dba85374dfe11f94015566a67528a1eee89a8750732
|
data/.rspec
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
--format=
|
1
|
+
--format=progress
|
2
2
|
--color
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
locomotivecms_coal (1.0.0.
|
4
|
+
locomotivecms_coal (1.0.0.rc1)
|
5
5
|
activesupport (~> 4.2.3)
|
6
6
|
faraday (~> 0.9.1)
|
7
7
|
faraday_middleware (~> 0.10.0)
|
@@ -9,16 +9,16 @@ PATH
|
|
9
9
|
GEM
|
10
10
|
remote: https://rubygems.org/
|
11
11
|
specs:
|
12
|
-
activesupport (4.2.
|
12
|
+
activesupport (4.2.4)
|
13
13
|
i18n (~> 0.7)
|
14
14
|
json (~> 1.7, >= 1.7.7)
|
15
15
|
minitest (~> 5.1)
|
16
16
|
thread_safe (~> 0.3, >= 0.3.4)
|
17
17
|
tzinfo (~> 1.1)
|
18
|
-
addressable (2.3.
|
19
|
-
byebug (4.0.
|
18
|
+
addressable (2.3.8)
|
19
|
+
byebug (4.0.5)
|
20
20
|
columnize (= 0.9.0)
|
21
|
-
codeclimate-test-reporter (0.4.
|
21
|
+
codeclimate-test-reporter (0.4.8)
|
22
22
|
simplecov (>= 0.7.1, < 1.0.0)
|
23
23
|
coderay (1.1.0)
|
24
24
|
columnize (0.9.0)
|
@@ -32,7 +32,7 @@ GEM
|
|
32
32
|
safe_yaml (~> 1.0.0)
|
33
33
|
diff-lcs (1.2.5)
|
34
34
|
docile (1.1.5)
|
35
|
-
domain_name (0.5.
|
35
|
+
domain_name (0.5.24)
|
36
36
|
unf (>= 0.0.5, < 1.0.0)
|
37
37
|
faraday (0.9.1)
|
38
38
|
multipart-post (>= 1.2, < 3)
|
@@ -46,12 +46,12 @@ GEM
|
|
46
46
|
multi_json (~> 1.0)
|
47
47
|
rspec (>= 2.0, < 4.0)
|
48
48
|
method_source (0.8.2)
|
49
|
-
mime-types (2.
|
50
|
-
minitest (5.
|
51
|
-
multi_json (1.11.
|
49
|
+
mime-types (2.6.2)
|
50
|
+
minitest (5.8.1)
|
51
|
+
multi_json (1.11.2)
|
52
52
|
multipart-post (2.0.0)
|
53
53
|
netrc (0.10.3)
|
54
|
-
pry (0.10.
|
54
|
+
pry (0.10.2)
|
55
55
|
coderay (~> 1.1.0)
|
56
56
|
method_source (~> 0.8.1)
|
57
57
|
slop (~> 3.4)
|
@@ -67,9 +67,9 @@ GEM
|
|
67
67
|
rspec-core (~> 3.2.0)
|
68
68
|
rspec-expectations (~> 3.2.0)
|
69
69
|
rspec-mocks (~> 3.2.0)
|
70
|
-
rspec-core (3.2.
|
70
|
+
rspec-core (3.2.3)
|
71
71
|
rspec-support (~> 3.2.0)
|
72
|
-
rspec-expectations (3.2.
|
72
|
+
rspec-expectations (3.2.1)
|
73
73
|
diff-lcs (>= 1.2.0, < 2.0)
|
74
74
|
rspec-support (~> 3.2.0)
|
75
75
|
rspec-mocks (3.2.1)
|
@@ -83,26 +83,26 @@ GEM
|
|
83
83
|
simplecov-html (~> 0.9.0)
|
84
84
|
simplecov-html (0.9.0)
|
85
85
|
slop (3.6.0)
|
86
|
-
term-ansicolor (1.3.
|
86
|
+
term-ansicolor (1.3.2)
|
87
87
|
tins (~> 1.0)
|
88
88
|
thor (0.19.1)
|
89
89
|
thread_safe (0.3.5)
|
90
|
-
tins (1.
|
90
|
+
tins (1.6.0)
|
91
91
|
tzinfo (1.2.2)
|
92
92
|
thread_safe (~> 0.1)
|
93
93
|
unf (0.1.4)
|
94
94
|
unf_ext
|
95
|
-
unf_ext (0.0.
|
95
|
+
unf_ext (0.0.7.1)
|
96
96
|
vcr (2.9.3)
|
97
|
-
webmock (1.
|
98
|
-
addressable (>= 2.
|
97
|
+
webmock (1.21.0)
|
98
|
+
addressable (>= 2.3.6)
|
99
99
|
crack (>= 0.3.2)
|
100
100
|
|
101
101
|
PLATFORMS
|
102
102
|
ruby
|
103
103
|
|
104
104
|
DEPENDENCIES
|
105
|
-
bundler (~> 1.
|
105
|
+
bundler (~> 1.10.6)
|
106
106
|
codeclimate-test-reporter (~> 0.4.7)
|
107
107
|
coveralls (~> 0.7.11)
|
108
108
|
json_spec (~> 1.1.4)
|
@@ -113,3 +113,6 @@ DEPENDENCIES
|
|
113
113
|
rspec (~> 3.2.0)
|
114
114
|
vcr
|
115
115
|
webmock
|
116
|
+
|
117
|
+
BUNDLED WITH
|
118
|
+
1.10.6
|
@@ -93,10 +93,10 @@ module Locomotive::Coal
|
|
93
93
|
[self.options[:path_prefix], 'api', 'v3'].join('/')
|
94
94
|
end
|
95
95
|
|
96
|
-
def prepare_uri(
|
97
|
-
|
96
|
+
def prepare_uri(str)
|
97
|
+
str = "http://#{str.to_s}" unless str.to_s =~ /^https?:\/\//
|
98
98
|
|
99
|
-
URI(
|
99
|
+
URI(str).tap do |uri|
|
100
100
|
uri.scheme = 'https' if ssl?
|
101
101
|
|
102
102
|
if uri.path == '/' || uri.path.blank?
|
data/locomotivecms_coal.gemspec
CHANGED
@@ -15,7 +15,7 @@ Gem::Specification.new do |spec|
|
|
15
15
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
16
16
|
spec.require_paths = ['lib']
|
17
17
|
|
18
|
-
spec.add_development_dependency 'bundler', '~> 1.
|
18
|
+
spec.add_development_dependency 'bundler', '~> 1.10.6'
|
19
19
|
spec.add_development_dependency 'rake', '~> 10.4.2'
|
20
20
|
|
21
21
|
spec.add_dependency 'faraday', '~> 0.9.1'
|
@@ -357,4 +357,39 @@ http_interactions:
|
|
357
357
|
string: "[]"
|
358
358
|
http_version:
|
359
359
|
recorded_at: Tue, 11 Aug 2015 13:12:35 GMT
|
360
|
+
- request:
|
361
|
+
method: post
|
362
|
+
uri: http://localhost:3000/tokens.json
|
363
|
+
body:
|
364
|
+
encoding: UTF-8
|
365
|
+
string: email=admin%40locomotivecms.com&password=locomotive
|
366
|
+
headers:
|
367
|
+
Accept:
|
368
|
+
- application/json
|
369
|
+
Content-Type:
|
370
|
+
- application/x-www-form-urlencoded
|
371
|
+
Accept-Encoding:
|
372
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
373
|
+
User-Agent:
|
374
|
+
- Ruby
|
375
|
+
response:
|
376
|
+
status:
|
377
|
+
code: 404
|
378
|
+
message: Not Found
|
379
|
+
headers:
|
380
|
+
Content-Type:
|
381
|
+
- text/html
|
382
|
+
Cache-Control:
|
383
|
+
- no-cache
|
384
|
+
X-Request-Id:
|
385
|
+
- 2b70fa6c-5d9c-42f3-b0f8-45ea224f63bb
|
386
|
+
X-Runtime:
|
387
|
+
- '0.015924'
|
388
|
+
Transfer-Encoding:
|
389
|
+
- chunked
|
390
|
+
body:
|
391
|
+
encoding: UTF-8
|
392
|
+
string: Hi, we are sorry but no site was found.
|
393
|
+
http_version:
|
394
|
+
recorded_at: Wed, 12 Aug 2015 22:47:38 GMT
|
360
395
|
recorded_with: VCR 2.9.3
|
data/spec/unit/client_spec.rb
CHANGED
@@ -2,24 +2,51 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
describe Locomotive::Coal::Client do
|
4
4
|
|
5
|
-
let(:uri) {
|
6
|
-
let(:credentials) {
|
7
|
-
|
5
|
+
let(:uri) { 'http://sample.lvh.me:4000/locomotive/api' }
|
6
|
+
let(:credentials) { { email: 'fake' } }
|
7
|
+
subject { described_class.new(uri, credentials) }
|
8
8
|
|
9
9
|
describe '#initialize' do
|
10
10
|
|
11
|
-
subject { client }
|
12
|
-
|
13
11
|
context 'no uri' do
|
14
|
-
let(:
|
12
|
+
let(:uri) { nil }
|
15
13
|
it { expect { subject }.to raise_error Locomotive::Coal::MissingURIOrCredentialsError }
|
16
14
|
end
|
17
15
|
|
18
16
|
context 'no credentials' do
|
19
|
-
let(:
|
17
|
+
let(:credentials) { nil }
|
20
18
|
it { expect { subject }.to raise_error Locomotive::Coal::MissingURIOrCredentialsError }
|
21
19
|
end
|
22
20
|
|
23
21
|
end
|
24
22
|
|
23
|
+
describe 'resources' do
|
24
|
+
describe '#current_site' do
|
25
|
+
subject { super().current_site }
|
26
|
+
it { is_expected.to be_a Locomotive::Coal::Resources::CurrentSite }
|
27
|
+
end
|
28
|
+
|
29
|
+
describe '#pages' do
|
30
|
+
subject { super().pages }
|
31
|
+
it { is_expected.to be_a Locomotive::Coal::Resources::Pages }
|
32
|
+
end
|
33
|
+
|
34
|
+
describe '#content_types' do
|
35
|
+
subject { super().content_types }
|
36
|
+
it { is_expected.to be_a Locomotive::Coal::Resources::ContentTypes }
|
37
|
+
end
|
38
|
+
|
39
|
+
describe '#content_entries' do
|
40
|
+
subject { super().content_entries(content_type) }
|
41
|
+
let(:content_type) { double(:content_type, slug: 'abc') }
|
42
|
+
it { is_expected.to be_a Locomotive::Coal::Resources::ContentEntries }
|
43
|
+
end
|
44
|
+
|
45
|
+
describe '#content_assets' do
|
46
|
+
subject { super().content_assets }
|
47
|
+
it { is_expected.to be_a Locomotive::Coal::Resources::ContentAssets }
|
48
|
+
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
25
52
|
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
describe Locomotive::Coal::ClientV2 do
|
2
|
+
let(:site) { double(:site, domains: [domain]) }
|
3
|
+
|
4
|
+
let(:client) { described_class.new('abc.com', { foo: :bar }) }
|
5
|
+
|
6
|
+
describe '#scope_by' do
|
7
|
+
subject { client.scope_by(site) }
|
8
|
+
|
9
|
+
context 'domains include current site' do
|
10
|
+
let(:domain) { 'abc.com' }
|
11
|
+
it { is_expected.to eq client }
|
12
|
+
end
|
13
|
+
|
14
|
+
context 'domains do not include current site' do
|
15
|
+
let(:domain) { 'xyz.com' }
|
16
|
+
it { is_expected.to_not eq client }
|
17
|
+
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
|
22
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: locomotivecms_coal
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.0.
|
4
|
+
version: 1.0.0.rc1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Didier Lafforgue
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-10-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 1.
|
19
|
+
version: 1.10.6
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 1.
|
26
|
+
version: 1.10.6
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rake
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -157,6 +157,7 @@ files:
|
|
157
157
|
- spec/support/pry.rb
|
158
158
|
- spec/support/vcr.rb
|
159
159
|
- spec/unit/client_spec.rb
|
160
|
+
- spec/unit/client_v2_spec.rb
|
160
161
|
- spec/unit/error_spec.rb
|
161
162
|
- spec/unit/paginated_resources_spec.rb
|
162
163
|
- spec/unit/resource_spec.rb
|
@@ -222,6 +223,7 @@ test_files:
|
|
222
223
|
- spec/support/pry.rb
|
223
224
|
- spec/support/vcr.rb
|
224
225
|
- spec/unit/client_spec.rb
|
226
|
+
- spec/unit/client_v2_spec.rb
|
225
227
|
- spec/unit/error_spec.rb
|
226
228
|
- spec/unit/paginated_resources_spec.rb
|
227
229
|
- spec/unit/resource_spec.rb
|