Sha256: 628f7bfed73c02ebb275257b96afd34d0ba553967287ce401993c398e6b92e16

Contents?: true

Size: 1.82 KB

Versions: 5

Compression:

Stored size: 1.82 KB

Contents

require "flex_commerce_api/api_base"
module FlexCommerce
  #
  # A flex commerce Static Page model
  #
  # This model provides access to the flex commerce static pages.
  # As managing the static pages is the job of the administration panel, this
  # model is read only.
  #
  # It is used much like an active record model.
  #
  # Examples:
  #
  #
  #
  #   # Fetching all static pages
  #
  #   FlexCommerce::StaticPage.all #fetches all static pages (actually the first page in case there are thousands)
  #
  #   # Pagination
  #
  #   FlexCommerce::StaticPage.paginate(page:2).all # Fetches page 2 of static pages.
  #   The page size is predefined on the server side
  #
  #   # Finding static pages
  #
  #   FlexCommerce::StaticPage.find(25) # Finds the static page with this unique id
  #
  #
  class StaticPage < FlexCommerceApi::ApiBase
    # @method find
    # @param [String] spec
    # Finds a static page
    # @return [FlexCommerce::Product] The static page
    # @raise [FlexCommerceApi::Error::NotFound] If not found

    # @method all
    # Returns all static pages
    # @return [FlexCommerce::StaticPage[]] An array of static pages or an empty array

    # @method paginate
    # Paginates the list of static pages by a preset page size
    # @param [Hash] options The options to paginate with
    # @param options [Numeric|String] :page The page to fetch

    has_many :slugs, class_name: "::FlexCommerce::Slug"
    has_one :template_definition, class_name: "::FlexCommerce::TemplateDefinition"
    has_one :template, class_name: "::FlexCommerce::Template"

    # @TODO Document other popular methods that we will support
    self.query_builder = ::FlexCommerceApi::JsonApiClientExtension::Builder
    
    class << self
      def_delegators :_new_scope, :temp_search
      def path(params, *args)
        super
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
flex_commerce_api-0.8.3 app/models/static_page.rb
flex_commerce_api-0.8.2 app/models/static_page.rb
flex_commerce_api-0.8.1 app/models/static_page.rb
flex_commerce_api-0.7 app/models/static_page.rb
flex_commerce_api-0.6.57 app/models/static_page.rb