Class: Weeblycloud::Page
- Inherits:
-
CloudResource
- Object
- CloudResource
- Weeblycloud::Page
- Defined in:
- lib/weeblycloud/page.rb
Overview
Represents a Page resource. cloud-developer.weebly.com/page.html
Instance Attribute Summary
Attributes inherited from CloudResource
Instance Method Summary collapse
-
#change_title(title) ⇒ Object
Changes the title of the page to title.
-
#id ⇒ Object
Returns the page_id.
-
#initialize(user_id, site_id, page_id, data = nil) ⇒ Page
constructor
A new instance of Page.
Methods inherited from CloudResource
#[], #get, #get_property, #to_s
Constructor Details
#initialize(user_id, site_id, page_id, data = nil) ⇒ Page
Returns a new instance of Page.
9 10 11 12 13 14 15 16 17 |
# File 'lib/weeblycloud/page.rb', line 9 def initialize(user_id, site_id, page_id, data = nil) @user_id = user_id.to_i @site_id = site_id.to_i @page_id = page_id.to_i @endpoint = "user/#{@user_id}/site/#{@site_id}/page/#{@page_id}" super(data) end |
Instance Method Details
#change_title(title) ⇒ Object
Changes the title of the page to title. Does not require calling the save() method.
26 27 28 29 30 31 32 33 34 |
# File 'lib/weeblycloud/page.rb', line 26 def change_title(title) data = {"title"=>title} response = @client.patch(@endpoint, :content=>data) if response.json["title"] == title return true else return false end end |
#id ⇒ Object
Returns the page_id
20 21 22 |
# File 'lib/weeblycloud/page.rb', line 20 def id @page_id end |