Sha256: a1a710b25b737fe503428b9150192fe63ca55b01bcb1c0cad80bd546af0758f1

Contents?: true

Size: 1.13 KB

Versions: 4

Compression:

Stored size: 1.13 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 :attachment_folders, :attachment_folder, "PlateApi::PlateObject::AttachmentFolder"
    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

4 entries across 4 versions & 1 rubygems

Version Path
plate_api-1.1.5 lib/plate_api/plate_object/site.rb
plate_api-1.1.4 lib/plate_api/plate_object/site.rb
plate_api-1.1.3 lib/plate_api/plate_object/site.rb
plate_api-1.1.2 lib/plate_api/plate_object/site.rb