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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b713be281a717b702f0a6c08c2338e8caf64000c
4
- data.tar.gz: 1d72b964e8c0bb8e9794b6bf1dc7e0989e622cc8
3
+ metadata.gz: aff31f15a22c2acfc6143964f04adc305cb78866
4
+ data.tar.gz: d4a4f954933fe0f8df28cc07a6ce2d4a2809a83a
5
5
  SHA512:
6
- metadata.gz: b8249d8b21debd27a354576eb7364396bffdc70e78c083cdb54159975a0a8e7f2913f1c76cefdda772611cc98c47917eaf23a614f46d1374465a7c9467451d93
7
- data.tar.gz: d91deb0a77005b742bceb2231c076b6173e27cdcd3d92fb42caddeef12f48ef7f1ea86f81cd7a5a735d7f766448c1c1d45a45bbc3dad9bbf0cb0fa178666b6b9
6
+ metadata.gz: dd1eda0840c268ca473156602d10d7a3cd7c5b1823e3f9312bc8ca9b1dc3b766e7851bad8e304645e6c69c564316abe3bdaeaec6770df4bc2785cd0eb6e6d1a6
7
+ data.tar.gz: 3cec4549cf778fdc345b1ffbd3ea95a8ef7091a7732ce86270ebcb96efed470c3b726b083ff82b0d60f14dba85374dfe11f94015566a67528a1eee89a8750732
data/.rspec CHANGED
@@ -1,2 +1,2 @@
1
- --format=doc
1
+ --format=progress
2
2
  --color
data/.travis.yml CHANGED
@@ -1,6 +1,6 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.2.0
3
+ - 2.2.2
4
4
  env:
5
5
  - CODECLIMATE_REPO_TOKEN=8d9c25de4eff1cd06d3accdc09775397e1a81be67e2a159453ba4e4408acae16
6
6
  addons:
data/Gemfile CHANGED
@@ -21,5 +21,5 @@ group :test do
21
21
  end
22
22
 
23
23
  platform :ruby do
24
- ruby '2.2.0'
24
+ ruby '2.2.2'
25
25
  end
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- locomotivecms_coal (1.0.0.pre.beta.2)
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.3)
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.7)
19
- byebug (4.0.3)
18
+ addressable (2.3.8)
19
+ byebug (4.0.5)
20
20
  columnize (= 0.9.0)
21
- codeclimate-test-reporter (0.4.7)
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.23)
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.4.3)
50
- minitest (5.7.0)
51
- multi_json (1.11.0)
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.1)
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.2)
70
+ rspec-core (3.2.3)
71
71
  rspec-support (~> 3.2.0)
72
- rspec-expectations (3.2.0)
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.0)
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.3.5)
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.6)
95
+ unf_ext (0.0.7.1)
96
96
  vcr (2.9.3)
97
- webmock (1.9.3)
98
- addressable (>= 2.2.7)
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.9.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(uri)
97
- uri = "http://#{uri.to_s}" unless uri.to_s =~ /^https?:\/\//
96
+ def prepare_uri(str)
97
+ str = "http://#{str.to_s}" unless str.to_s =~ /^https?:\/\//
98
98
 
99
- URI(uri).tap do |uri|
99
+ URI(str).tap do |uri|
100
100
  uri.scheme = 'https' if ssl?
101
101
 
102
102
  if uri.path == '/' || uri.path.blank?
@@ -113,7 +113,7 @@ module Locomotive::Coal::Resources
113
113
  def encode_array_to_hash(value)
114
114
  {}.tap do |hash|
115
115
  value.each_with_index do |v, index|
116
- hash[index] = v.to_hash
116
+ hash[index] = _encode_parameters(v)
117
117
  end
118
118
  end
119
119
  end
@@ -3,6 +3,6 @@
3
3
  # 1.0.0-alpha < 1.0.0-alpha.1 < 1.0.0-alpha.beta < 1.0.0-beta < 1.0.0-beta.2 < 1.0.0-beta.11 < 1.0.0-rc.1 < 1.0.0
4
4
  module Locomotive
5
5
  module Coal
6
- VERSION = '1.0.0-beta.2'
6
+ VERSION = '1.0.0.rc1'
7
7
  end
8
8
  end
@@ -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.9.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
@@ -2,24 +2,51 @@ require 'spec_helper'
2
2
 
3
3
  describe Locomotive::Coal::Client do
4
4
 
5
- let(:uri) { nil }
6
- let(:credentials) { nil }
7
- let(:client) { described_class.new(uri, credentials) }
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(:credentials) { { email: 'fake' } }
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(:uri) { 'http://sample.lvh.me:4000/locomotive/api' }
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.pre.beta.2
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-08-11 00:00:00.000000000 Z
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.9.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.9.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