Skip to content

Commit f3c8deb

Browse files
committed
the fullpaths method of the Pages API resource returns also the handle
1 parent dcc2257 commit f3c8deb

File tree

5 files changed

+33
-27
lines changed

5 files changed

+33
-27
lines changed

Gemfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ group :development do
2424
# gem 'locomotivecms_common', path: '../gems/common', require: false
2525
# gem 'locomotivecms_common', github: 'locomotivecms/common', ref: '257047b', require: false
2626

27-
# gem 'locomotivecms_steam', path: '../gems/steam', require: false
27+
gem 'locomotivecms_steam', path: '../gems/steam', require: false
2828
# gem 'locomotivecms_steam', github: 'locomotivecms/steam', ref: 'c44f003', require: false
2929

3030
# gem 'locomotive_liquid', path: '../gems/liquid' # for Developers

Gemfile.lock

Lines changed: 28 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,33 @@ GIT
44
specs:
55
database_cleaner (1.5.1)
66

7+
PATH
8+
remote: ../gems/steam
9+
specs:
10+
locomotivecms_steam (1.1.0.rc2)
11+
RedCloth (~> 4.2.9)
12+
autoprefixer-rails (~> 6.3.3.1)
13+
chronic (~> 0.10.2)
14+
coffee-script (~> 2.4.1)
15+
compass (~> 1.0.3)
16+
dragonfly (~> 1.0.12)
17+
haml (~> 4.0.6)
18+
httparty (~> 0.13.6)
19+
kramdown (~> 1.10.0)
20+
locomotivecms-solid (~> 4.0.1)
21+
locomotivecms_common (~> 0.1.0)
22+
mime-types (~> 2.6.1)
23+
mimetype-fu (~> 0.1.2)
24+
moneta (~> 0.8.0)
25+
morphine (~> 0.1.1)
26+
nokogiri (~> 1.6.7.2)
27+
rack-cache (~> 1.6.1)
28+
rack-rewrite (~> 1.5.1)
29+
rack_csrf (~> 2.5.0)
30+
sanitize (~> 4.0.1)
31+
sass (~> 3.4.21)
32+
sprockets (~> 3.5.2)
33+
734
PATH
835
remote: .
936
specs:
@@ -293,29 +320,6 @@ GEM
293320
attr_extras (~> 4.4.0)
294321
colorize
295322
stringex (~> 2.6.0)
296-
locomotivecms_steam (1.1.0.rc2)
297-
RedCloth (~> 4.2.9)
298-
autoprefixer-rails (~> 6.3.3.1)
299-
chronic (~> 0.10.2)
300-
coffee-script (~> 2.4.1)
301-
compass (~> 1.0.3)
302-
dragonfly (~> 1.0.12)
303-
haml (~> 4.0.6)
304-
httparty (~> 0.13.6)
305-
kramdown (~> 1.10.0)
306-
locomotivecms-solid (~> 4.0.1)
307-
locomotivecms_common (~> 0.1.0)
308-
mime-types (~> 2.6.1)
309-
mimetype-fu (~> 0.1.2)
310-
moneta (~> 0.8.0)
311-
morphine (~> 0.1.1)
312-
nokogiri (~> 1.6.7.2)
313-
rack-cache (~> 1.6.1)
314-
rack-rewrite (~> 1.5.1)
315-
rack_csrf (~> 2.5.0)
316-
sanitize (~> 4.0.1)
317-
sass (~> 3.4.21)
318-
sprockets (~> 3.5.2)
319323
loofah (2.0.3)
320324
nokogiri (>= 1.5.9)
321325
mail (2.6.3)
@@ -531,6 +535,7 @@ DEPENDENCIES
531535
i18n-tasks (~> 0.8.7)
532536
json_spec (~> 1.1.4)
533537
locomotivecms!
538+
locomotivecms_steam!
534539
pickle
535540
pry
536541
pry-byebug

app/api/locomotive/api/entities/page_entity.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ class PageEntity < BaseEntity
4545
class FullpathPageEntity < BaseEntity
4646

4747
expose :fullpath
48+
expose :handle
4849

4950
unexpose :created_at
5051
unexpose :updated_at

app/api/locomotive/api/resources/page_resource.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class PageResource < Grape::API
2323
get '/fullpaths' do
2424
authorize Page, :index?
2525

26-
present pages.only(:_id, :fullpath), with: Locomotive::API::Entities::FullpathPageEntity
26+
present pages.only(:_id, :fullpath, :handle), with: Locomotive::API::Entities::FullpathPageEntity
2727
end
2828

2929
desc "Show a page"

spec/api/locomotive/api/resources/page_resource_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131

3232
it 'returns a successful response' do
3333
expect(parsed_response.size).to eq 2
34-
expect(parsed_response.first.keys).to eq %w(_id fullpath)
34+
expect(parsed_response.first.keys).to eq %w(_id fullpath handle)
3535
expect(parsed_response.map { |h| h['fullpath'] }).to eq %w(index 404)
3636
end
3737

@@ -41,7 +41,7 @@
4141

4242
it 'returns a successful response' do
4343
expect(parsed_response.size).to eq 2
44-
expect(parsed_response.first.keys).to eq %w(_id fullpath)
44+
expect(parsed_response.first.keys).to eq %w(_id fullpath handle)
4545
expect(parsed_response.map { |h| h['fullpath'] }).to eq %w(index 404)
4646
end
4747

0 commit comments

Comments
 (0)