Sha256: 098eea8821ebb29c34c1402a4d08ec4e6f06a6f59b8f90c4c44bd5851ca99304

Contents?: true

Size: 585 Bytes

Versions: 2

Compression:

Stored size: 585 Bytes

Contents

module Locomotive::Coal
  module Resources

    class Sites < Struct.new(:uri, :token)

      include Locomotive::Coal::Request

      def all
        get('sites').map do |attributes|
          Resource.new(attributes)
        end
      end

      def create(attributes = {})
        data = post('sites', { site: attributes })
        Resource.new(data)
      end

      def by_subdomain(subdomain)
        all.find { |site| site.subdomain == subdomain.to_s }
      end

      def destroy(id)
        data = delete('sites', id)
        Resource.new(data)
      end

    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
locomotivecms_coal-1.0.0.pre.alpha.1 lib/locomotive/coal/resources/sites.rb
locomotivecms_coal-1.0.0.pre.alpha lib/locomotive/coal/resources/sites.rb