Sha256: 64230a3812923364f9e1e92f4d7d6ace6d6f8a052b65e07f450a1ce5dc9772aa

Contents?: true

Size: 1.2 KB

Versions: 27

Compression:

Stored size: 1.2 KB

Contents

# frozen_string_literal: true
require 'dato/account/repo/base'

module Dato
  module Account
    module Repo
      class Site < Base
        def find(site_id)
          get_request "/sites/#{site_id}"
        end

        def all
          get_request '/sites'
        end

        def create(resource_attributes)
          body = JsonApiSerializer.new(
            type: :site,
            attributes: %i(domain internal_subdomain name notes ssg template)
          ).serialize(resource_attributes)

          post_request '/sites', body
        end

        def update(site_id, resource_attributes)
          body = JsonApiSerializer.new(
            type: :site,
            attributes: %i(domain internal_subdomain name notes)
          ).serialize(resource_attributes, site_id)

          put_request "/sites/#{site_id}", body
        end

        def destroy(site_id)
          delete_request "/sites/#{site_id}"
        end

        def duplicate(site_id, resource_attributes)
          body = JsonApiSerializer.new(
            type: :site,
            attributes: %i(name)
          ).serialize(resource_attributes)

          post_request "/sites/#{site_id}/duplicate", body
        end
      end
    end
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
dato-0.5.1 lib/dato/account/repo/site.rb
dato-0.5.0 lib/dato/account/repo/site.rb
dato-0.4.3 lib/dato/account/repo/site.rb
dato-0.4.2 lib/dato/account/repo/site.rb
dato-0.4.1 lib/dato/account/repo/site.rb
dato-0.4.0 lib/dato/account/repo/site.rb
dato-0.3.31 lib/dato/account/repo/site.rb
dato-0.4.0.pre lib/dato/account/repo/site.rb
dato-0.3.30 lib/dato/account/repo/site.rb
dato-0.3.29 lib/dato/account/repo/site.rb
dato-0.3.28 lib/dato/account/repo/site.rb
dato-0.3.27 lib/dato/account/repo/site.rb
dato-0.3.26 lib/dato/account/repo/site.rb
dato-0.3.25 lib/dato/account/repo/site.rb
dato-0.3.24 lib/dato/account/repo/site.rb
dato-0.3.23 lib/dato/account/repo/site.rb
dato-0.3.22 lib/dato/account/repo/site.rb
dato-0.3.21 lib/dato/account/repo/site.rb
dato-0.3.20 lib/dato/account/repo/site.rb
dato-0.3.19 lib/dato/account/repo/site.rb