locomotivecms_coal 1.6.0.beta1 → 1.7.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (33) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +1 -0
  3. data/.travis.yml +2 -3
  4. data/Gemfile +1 -6
  5. data/Gemfile.lock +54 -59
  6. data/MIT-LICENSE +1 -1
  7. data/README.md +20 -5
  8. data/lib/locomotive/coal/client.rb +8 -0
  9. data/lib/locomotive/coal/resources/accounts.rb +33 -0
  10. data/lib/locomotive/coal/resources/concerns/request.rb +19 -1
  11. data/lib/locomotive/coal/version.rb +1 -1
  12. data/lib/locomotive/coal.rb +1 -0
  13. data/locomotivecms_coal.gemspec +5 -6
  14. data/spec/fixtures/coal_cassettes/accounts.yml +214 -0
  15. data/spec/fixtures/coal_cassettes/client.yml +277 -163
  16. data/spec/fixtures/coal_cassettes/content_assets.yml +144 -445
  17. data/spec/fixtures/coal_cassettes/content_entries.yml +963 -1647
  18. data/spec/fixtures/coal_cassettes/content_types.yml +387 -209
  19. data/spec/fixtures/coal_cassettes/current_site.yml +89 -49
  20. data/spec/fixtures/coal_cassettes/memberships.yml +143 -77
  21. data/spec/fixtures/coal_cassettes/my_account.yml +163 -99
  22. data/spec/fixtures/coal_cassettes/pages.yml +177 -99
  23. data/spec/fixtures/coal_cassettes/sections.yml +121 -78
  24. data/spec/fixtures/coal_cassettes/sites.yml +108 -141
  25. data/spec/fixtures/coal_cassettes/snippets.yml +140 -76
  26. data/spec/fixtures/coal_cassettes/theme_assets.yml +142 -254
  27. data/spec/fixtures/coal_cassettes/token.yml +64 -43
  28. data/spec/fixtures/coal_cassettes/translations.yml +140 -76
  29. data/spec/fixtures/coal_cassettes/version.yml +54 -30
  30. data/spec/integration/resources/accounts_spec.rb +38 -0
  31. data/spec/integration/resources/sections_spec.rb +1 -1
  32. data/spec/integration/resources/token_spec.rb +1 -1
  33. metadata +20 -30
@@ -7,14 +7,16 @@ http_interactions:
7
7
  encoding: UTF-8
8
8
  string: email=admin%40locomotivecms.com&password=locomotive
9
9
  headers:
10
+ User-Agent:
11
+ - Faraday v0.15.4
10
12
  Accept:
11
13
  - application/json
14
+ Accept-Encoding:
15
+ - gzip,deflate
16
+ Date:
17
+ - Sun, 17 Nov 2019 16:39:24 GMT
12
18
  Content-Type:
13
19
  - application/x-www-form-urlencoded
14
- Accept-Encoding:
15
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
16
- User-Agent:
17
- - Ruby
18
20
  response:
19
21
  status:
20
22
  code: 201
@@ -22,38 +24,50 @@ http_interactions:
22
24
  headers:
23
25
  Content-Type:
24
26
  - application/json
25
- Etag:
26
- - W/"120917583ae3f64355d682b690f7cb40"
27
+ Content-Length:
28
+ - '32'
29
+ Connection:
30
+ - keep-alive
31
+ Status:
32
+ - 201 Created
27
33
  Cache-Control:
28
34
  - max-age=0, private, must-revalidate
29
- X-Request-Id:
30
- - c9b0e179-e34b-4366-b5a4-5e1e29ca34be
35
+ Etag:
36
+ - W/"410e3d6fde24f39257a7cc619b61baa7"
31
37
  X-Runtime:
32
- - '0.020447'
33
- Content-Length:
34
- - '32'
38
+ - '0.004813'
39
+ X-Request-Id:
40
+ - 4dbdd6ff-8e32-494e-a364-3c8f05ed4619
41
+ Date:
42
+ - Sun, 17 Nov 2019 16:39:24 GMT
43
+ X-Powered-By:
44
+ - Phusion Passenger 6.0.4
45
+ Server:
46
+ - nginx/1.17.3 + Phusion Passenger 6.0.4
35
47
  body:
36
48
  encoding: UTF-8
37
- string: '{"token":"E2aoXzMxkFsLnCcmCcc_"}'
49
+ string: '{"token":"bzwAyFQzcchf_hgDQhz3"}'
38
50
  http_version:
39
- recorded_at: Sat, 21 Nov 2015 22:31:00 GMT
51
+ recorded_at: Sun, 17 Nov 2019 16:39:24 GMT
40
52
  - request:
41
53
  method: get
42
- uri: http://localhost:3000/locomotive/sample/api/v3/version.json?auth_token=E2aoXzMxkFsLnCcmCcc_&email=admin@locomotivecms.com&token=E2aoXzMxkFsLnCcmCcc_
54
+ uri: http://localhost:3000/locomotive/sample/api/v3/version.json?auth_token=bzwAyFQzcchf_hgDQhz3&email=admin@locomotivecms.com&token=bzwAyFQzcchf_hgDQhz3
43
55
  body:
44
- encoding: US-ASCII
56
+ encoding: UTF-8
45
57
  string: ''
46
58
  headers:
59
+ User-Agent:
60
+ - Faraday v0.15.4
47
61
  Accept:
48
62
  - application/json
63
+ Accept-Encoding:
64
+ - gzip,deflate
65
+ Date:
66
+ - Sun, 17 Nov 2019 16:39:24 GMT
49
67
  X-Locomotive-Account-Email:
50
68
  - admin@locomotivecms.com
51
69
  X-Locomotive-Account-Token:
52
- - E2aoXzMxkFsLnCcmCcc_
53
- Accept-Encoding:
54
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
55
- User-Agent:
56
- - Ruby
70
+ - bzwAyFQzcchf_hgDQhz3
57
71
  response:
58
72
  status:
59
73
  code: 200
@@ -61,19 +75,29 @@ http_interactions:
61
75
  headers:
62
76
  Content-Type:
63
77
  - application/json
64
- Etag:
65
- - W/"a29b8ca75f03b52361cf5f1f8ebf001a"
78
+ Content-Length:
79
+ - '22'
80
+ Connection:
81
+ - keep-alive
82
+ Status:
83
+ - 200 OK
66
84
  Cache-Control:
67
85
  - max-age=0, private, must-revalidate
68
- X-Request-Id:
69
- - d760b628-240d-4c11-a211-10dcd5102028
86
+ Etag:
87
+ - W/"f981a5a7069dbbda33875006acb1b026"
70
88
  X-Runtime:
71
- - '0.018271'
72
- Content-Length:
73
- - '22'
89
+ - '0.006873'
90
+ X-Request-Id:
91
+ - 5a103059-2a24-401f-94ca-49c2e1c657a9
92
+ Date:
93
+ - Sun, 17 Nov 2019 16:39:24 GMT
94
+ X-Powered-By:
95
+ - Phusion Passenger 6.0.4
96
+ Server:
97
+ - nginx/1.17.3 + Phusion Passenger 6.0.4
74
98
  body:
75
99
  encoding: UTF-8
76
- string: '{"engine":"3.0.0.rc3"}'
100
+ string: '{"engine":"4.0.0.rc0"}'
77
101
  http_version:
78
- recorded_at: Sat, 21 Nov 2015 22:31:00 GMT
79
- recorded_with: VCR 2.9.3
102
+ recorded_at: Sun, 17 Nov 2019 16:39:24 GMT
103
+ recorded_with: VCR 4.0.0
@@ -0,0 +1,38 @@
1
+ require 'spec_helper'
2
+
3
+ describe Locomotive::Coal::Resources::Accounts, order: :defined do
4
+
5
+ before { VCR.insert_cassette 'accounts', record: :new_episodes }
6
+ after { VCR.eject_cassette }
7
+
8
+ let(:uri) { TEST_API_V3_URI }
9
+ let(:credentials) { { email: TEST_API_EMAIL, token: api_token } }
10
+ let(:accounts) { described_class.new(uri, credentials) }
11
+
12
+ describe '#all' do
13
+
14
+ subject { accounts.all }
15
+ it { expect(subject.size).to be > 0 }
16
+
17
+ describe 'first account' do
18
+ subject { accounts.all }
19
+ it { expect(subject.to_a.map { |a| a.name }).to include('New Admin', 'John Doe') }
20
+ end
21
+ end
22
+
23
+ describe '#create' do
24
+ subject { create_account }
25
+ it { expect(subject._id).not_to eq nil }
26
+ end
27
+
28
+ describe '#destroy' do
29
+ let(:new_account) { accounts.all.find { |a| a.email == 'jane@doe.net' } || create_account }
30
+ subject { accounts.destroy(new_account._id) }
31
+ it { expect(subject._id).not_to eq nil }
32
+ end
33
+
34
+ def create_account
35
+ accounts.create(name: 'Jane', email: 'jane@doe.net', password: 'easyone', password_confirmation: 'easyone')
36
+ end
37
+
38
+ end
@@ -37,7 +37,7 @@ describe Locomotive::Coal::Resources::Sections, order: :defined do
37
37
  settings: [
38
38
  {
39
39
  id: 'title',
40
- type: 'string'
40
+ type: 'text'
41
41
  }
42
42
  ]
43
43
  })
@@ -14,7 +14,7 @@ describe Locomotive::Coal::Resources::Token do
14
14
  subject { token.get }
15
15
 
16
16
  context 'uri not pointing to a Locomotive engine' do
17
- let(:uri) { URI('http://acme.example.com:3000') }
17
+ let(:uri) { URI('http://acme.example.local:3000') }
18
18
  let(:credentials) { TEST_API_CREDENTIALS }
19
19
  it { expect { subject }.to raise_error Locomotive::Coal::UnknownResourceError }
20
20
  end
metadata CHANGED
@@ -1,43 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: locomotivecms_coal
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.0.beta1
4
+ version: 1.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Didier Lafforgue
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-12-19 00:00:00.000000000 Z
11
+ date: 2021-09-07 00:00:00.000000000 Z
12
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.16.1
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: 1.16.1
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: rake
29
15
  requirement: !ruby/object:Gem::Requirement
30
16
  requirements:
31
17
  - - "~>"
32
18
  - !ruby/object:Gem::Version
33
- version: 12.3.0
19
+ version: 13.0.1
34
20
  type: :development
35
21
  prerelease: false
36
22
  version_requirements: !ruby/object:Gem::Requirement
37
23
  requirements:
38
24
  - - "~>"
39
25
  - !ruby/object:Gem::Version
40
- version: 12.3.0
26
+ version: 13.0.1
41
27
  - !ruby/object:Gem::Dependency
42
28
  name: httpclient
43
29
  requirement: !ruby/object:Gem::Requirement
@@ -58,28 +44,28 @@ dependencies:
58
44
  requirements:
59
45
  - - "~>"
60
46
  - !ruby/object:Gem::Version
61
- version: 0.15.4
47
+ version: '0.17'
62
48
  type: :runtime
63
49
  prerelease: false
64
50
  version_requirements: !ruby/object:Gem::Requirement
65
51
  requirements:
66
52
  - - "~>"
67
53
  - !ruby/object:Gem::Version
68
- version: 0.15.4
54
+ version: '0.17'
69
55
  - !ruby/object:Gem::Dependency
70
56
  name: faraday_middleware
71
57
  requirement: !ruby/object:Gem::Requirement
72
58
  requirements:
73
59
  - - "~>"
74
60
  - !ruby/object:Gem::Version
75
- version: 0.12.2
61
+ version: 0.13.1
76
62
  type: :runtime
77
63
  prerelease: false
78
64
  version_requirements: !ruby/object:Gem::Requirement
79
65
  requirements:
80
66
  - - "~>"
81
67
  - !ruby/object:Gem::Version
82
- version: 0.12.2
68
+ version: 0.13.1
83
69
  - !ruby/object:Gem::Dependency
84
70
  name: activesupport
85
71
  requirement: !ruby/object:Gem::Requirement
@@ -89,7 +75,7 @@ dependencies:
89
75
  version: 5.1.5
90
76
  - - "<"
91
77
  - !ruby/object:Gem::Version
92
- version: '6.0'
78
+ version: '6.1'
93
79
  type: :runtime
94
80
  prerelease: false
95
81
  version_requirements: !ruby/object:Gem::Requirement
@@ -99,21 +85,21 @@ dependencies:
99
85
  version: 5.1.5
100
86
  - - "<"
101
87
  - !ruby/object:Gem::Version
102
- version: '6.0'
88
+ version: '6.1'
103
89
  - !ruby/object:Gem::Dependency
104
90
  name: mime-types
105
91
  requirement: !ruby/object:Gem::Requirement
106
92
  requirements:
107
93
  - - "~>"
108
94
  - !ruby/object:Gem::Version
109
- version: 3.1.0
95
+ version: 3.3.0
110
96
  type: :runtime
111
97
  prerelease: false
112
98
  version_requirements: !ruby/object:Gem::Requirement
113
99
  requirements:
114
100
  - - "~>"
115
101
  - !ruby/object:Gem::Version
116
- version: 3.1.0
102
+ version: 3.3.0
117
103
  description: The LocomotiveCMS Coal is the API ruby client for the LocomotiveCMS platform
118
104
  email:
119
105
  - didier@nocoffee.fr
@@ -135,6 +121,7 @@ files:
135
121
  - lib/locomotive/coal/error.rb
136
122
  - lib/locomotive/coal/paginated_resources.rb
137
123
  - lib/locomotive/coal/resource.rb
124
+ - lib/locomotive/coal/resources/accounts.rb
138
125
  - lib/locomotive/coal/resources/base.rb
139
126
  - lib/locomotive/coal/resources/concerns/request.rb
140
127
  - lib/locomotive/coal/resources/content_assets.rb
@@ -156,6 +143,7 @@ files:
156
143
  - locomotivecms_coal.gemspec
157
144
  - spec/fixtures/assets/locomotive.png
158
145
  - spec/fixtures/assets/rails.png
146
+ - spec/fixtures/coal_cassettes/accounts.yml
159
147
  - spec/fixtures/coal_cassettes/client.yml
160
148
  - spec/fixtures/coal_cassettes/content_assets.yml
161
149
  - spec/fixtures/coal_cassettes/content_entries.yml
@@ -172,6 +160,7 @@ files:
172
160
  - spec/fixtures/coal_cassettes/translations.yml
173
161
  - spec/fixtures/coal_cassettes/version.yml
174
162
  - spec/integration/client_spec.rb
163
+ - spec/integration/resources/accounts_spec.rb
175
164
  - spec/integration/resources/content_assets_spec.rb
176
165
  - spec/integration/resources/content_entries_spec.rb
177
166
  - spec/integration/resources/content_types_spec.rb
@@ -212,18 +201,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
212
201
  version: '2.0'
213
202
  required_rubygems_version: !ruby/object:Gem::Requirement
214
203
  requirements:
215
- - - ">"
204
+ - - ">="
216
205
  - !ruby/object:Gem::Version
217
- version: 1.3.1
206
+ version: '0'
218
207
  requirements: []
219
- rubyforge_project:
220
- rubygems_version: 2.7.3
208
+ rubygems_version: 3.1.4
221
209
  signing_key:
222
210
  specification_version: 4
223
211
  summary: The LocomotiveCMS Coal is the API ruby client for the LocomotiveCMS platform
224
212
  test_files:
225
213
  - spec/fixtures/assets/locomotive.png
226
214
  - spec/fixtures/assets/rails.png
215
+ - spec/fixtures/coal_cassettes/accounts.yml
227
216
  - spec/fixtures/coal_cassettes/client.yml
228
217
  - spec/fixtures/coal_cassettes/content_assets.yml
229
218
  - spec/fixtures/coal_cassettes/content_entries.yml
@@ -240,6 +229,7 @@ test_files:
240
229
  - spec/fixtures/coal_cassettes/translations.yml
241
230
  - spec/fixtures/coal_cassettes/version.yml
242
231
  - spec/integration/client_spec.rb
232
+ - spec/integration/resources/accounts_spec.rb
243
233
  - spec/integration/resources/content_assets_spec.rb
244
234
  - spec/integration/resources/content_entries_spec.rb
245
235
  - spec/integration/resources/content_types_spec.rb