Class: ButterCMS::Page

Inherits:
ButterResource show all
Defined in:
lib/buttercms/page.rb

Instance Attribute Summary

Attributes inherited from ButterResource

#data, #meta

Class Method Summary collapse

Methods inherited from ButterResource

all, create, endpoint, find, #initialize, #inspect, #marshal_dump, #marshal_load, patch_endpoint, update

Constructor Details

This class inherits a constructor from ButterCMS::ButterResource

Class Method Details

.get(page_type, slug, options = {}) ⇒ Object



13
14
15
16
17
# File 'lib/buttercms/page.rb', line 13

def self.get(page_type, slug, options = {})
  response = ButterCMS.request(self.endpoint("#{page_type}/#{slug}"), options)

  self.create_object(response)
end

.list(page_type, options = {}) ⇒ Object



7
8
9
10
11
# File 'lib/buttercms/page.rb', line 7

def self.list(page_type, options = {})
  response = ButterCMS.request(self.endpoint(page_type), options)

  self.create_collection(response)
end

.resource_pathObject



3
4
5
# File 'lib/buttercms/page.rb', line 3

def self.resource_path
  "/pages/"
end

.search(query = '', options = {}) ⇒ Object



19
20
21
22
23
# File 'lib/buttercms/page.rb', line 19

def self.search(query = '', options = {})
  response = ButterCMS.request('/pages/search/', {query: query}.merge(options))
  
  self.create_collection(response)
end