lib/locomotive/coal/resources/sites.rb in locomotivecms_coal-1.0.0.pre.alpha.1 vs lib/locomotive/coal/resources/sites.rb in locomotivecms_coal-1.0.0.pre.alpha.2
- old
+ new
@@ -1,29 +1,17 @@
module Locomotive::Coal
module Resources
- class Sites < Struct.new(:uri, :token)
+ class Sites < Base
- 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
-
+ # Only v2.x
def by_subdomain(subdomain)
all.find { |site| site.subdomain == subdomain.to_s }
end
- def destroy(id)
- data = delete('sites', id)
- Resource.new(data)
+ # Only >= v3
+ def by_handle(handle)
+ all.find { |site| site.handle == handle.to_s }
end
end
end