Sha256: b69f4de4d9d1b9e785fdd1c42a637af4fb142e02c2b479e14406a03015eaa2be

Contents?: true

Size: 1.04 KB

Versions: 3

Compression:

Stored size: 1.04 KB

Contents

module PlateApi::PlateObject
  class Site < Base

    has_one :theme, "PlateApi::PlateObject::Theme"
    has_one :company, "PlateApi::PlateObject::Company"
    has_many :site_translations, :site_translation, "PlateApi::PlateObject::SiteTranslation"
    has_many :posts, :post, "PlateApi::PlateObject::Post"
    has_many :sections, :section, "PlateApi::PlateObject::Section"
    has_many :rows, :row, "PlateApi::PlateObject::Row"
    has_many :columns, :column, "PlateApi::PlateObject::Column"
    has_many :elements, :element, "PlateApi::PlateObject::Element"
    has_many :attachments, :attachment, "PlateApi::PlateObject::Attachment"

    def self.api_name
      "sites"
    end

    def self.parent_class
      Company
    end

    def create_attachment(file, extra_parameters={})
      raise ArgumentError.new("No File is given as input") unless file.is_a? File
      parameters = extra_parameters.merge({file: file})
      @object_handler.api_connector.handler(PlateApi::PlateObject::Attachment).create(self, parameters, :post_multipart)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
plate_api-1.1.1 lib/plate_api/plate_object/site.rb
plate_api-1.1.0 lib/plate_api/plate_object/site.rb
plate_api-1.0.0 lib/plate_api/plate_object/site.rb