Sha256: bc0e0163b9e98a297169a1d8fd786c334c8a159247a69e162ada1a74dad7e855

Contents?: true

Size: 812 Bytes

Versions: 1

Compression:

Stored size: 812 Bytes

Contents

require "weeblycloud/cloudresource"

module Weeblycloud

  # Represents a Page resource.
  # https://cloud-developer.weebly.com/page.html
  class Page < CloudResource

    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

    # Returns the page_id
    def id
      @page_id
    end

    # Changes the title of the page to title. Does not require calling the
    # save() method.
    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

  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
weeblycloud-1.0.0 lib/weeblycloud/page.rb