module Simplecast::Client::Resource

Public Instance Methods

all() click to toggle source
# File lib/simplecast/client/resource.rb, line 9
def all
  all = client.get("#{resource_plural_name_lower}.json")
  all.map {|item| model.new(item) }
end
client() click to toggle source
# File lib/simplecast/client/resource.rb, line 16
def client
  @client ||= Simplecast.client
end
find(id) click to toggle source
# File lib/simplecast/client/resource.rb, line 5
def find(id)
  api_obj = client.get("#{resource_plural_name_lower}/#{id}.json")
  model.new(api_obj)
end
model() click to toggle source
# File lib/simplecast/client/resource.rb, line 19
def model
  Simplecast.const_get(name.split("::").last)
end
resource_plural_name_lower() click to toggle source
# File lib/simplecast/client/resource.rb, line 13
def resource_plural_name_lower
  send(:name).split('::').last.downcase + "s"
end