Sha256: 55f6490cddae938765a5f3b36c5cc17bc858c2925b38a3a9c9643dbbaccc1646

Contents?: true

Size: 1.91 KB

Versions: 1

Compression:

Stored size: 1.91 KB

Contents

module Voog
  class API
    module Pages

      # List pages
      def pages(params = {})
        paginate 'pages', {query: params}
      end

      # Get a single page
      def page(id, params = {})
        get "pages/#{id}", {query: params}
      end

      # Create a page
      def create_page(data)
        post 'pages', data
      end

      # Update a page
      def update_page(id, data)
        put "pages/#{id}", data
      end

      # Patch a page
      def patch_page(id, data)
        patch "pages/#{id}", data
      end

      # Delete a page
      def delete_page(id)
        delete "pages/#{id}"
      end

      # Update/create a key in page data field
      #
      # @param id [String] key in data field
      def update_page_data(page_id, id, data)
        put "pages/#{page_id}/data/#{id}", {value: data}
      end

      # Delete a key from page data field
      #
      # @param id [String] key in data field
      def delete_page_data(page_id, id)
        delete "pages/#{page_id}/data/#{id}"
      end

      # Page contents

      # List contents for page
      def page_contents(id, params = {})
        contents(Voog::API::Contents::ParentKind::Page, id, params)
      end

      # Get a single content for page
      def page_content(page_id, id, params = {})
        content(Voog::API::Contents::ParentKind::Page, page_id, id, params)
      end

      # Create a page content for page
      def create_page_content(page_id, data)
        create_content(Voog::API::Contents::ParentKind::Page, page_id, data)
      end

      # Delete a content from page
      def delete_page_content(page_id, id)
        delete_content(Voog::API::Contents::ParentKind::Page, page_id, id)
      end

      # Reorder/move page content inside/between content areas and parent objects
      def move_page_content(page_id, id, params = {})
        move_content(Voog::API::Contents::ParentKind::Page, page_id, id, params)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
voog_api-0.0.10 lib/voog_api/api/pages.rb