class Fulcrum::Resource

Attributes

client[RW]

Public Class Methods

new(client) click to toggle source
# File lib/fulcrum/resource.rb, line 5
def initialize(client)
  self.client = client
end

Public Instance Methods

attributes_for_object(object) click to toggle source
# File lib/fulcrum/resource.rb, line 33
def attributes_for_object(object)
  attributes = {}
  attributes[resource_name] = object
  attributes
end
call(method = :get, path = '', params = {}) click to toggle source
# File lib/fulcrum/resource.rb, line 17
def call(method = :get, path = '', params = {})
  client.call(method, path, params)
end
collection(format = 'json') click to toggle source
# File lib/fulcrum/resource.rb, line 21
def collection(format = 'json')
  "#{resources_name}.#{format}"
end
member(id, format = 'json') click to toggle source
# File lib/fulcrum/resource.rb, line 25
def member(id, format = 'json')
  "#{resources_name}/#{id}.#{format}"
end
member_action(id, action, format = 'json') click to toggle source
# File lib/fulcrum/resource.rb, line 29
def member_action(id, action, format = 'json')
  "#{resources_name}/#{id}/#{action}.#{format}"
end
resource_name() click to toggle source
# File lib/fulcrum/resource.rb, line 9
def resource_name
  self.class.to_s.split('::').last.underscore
end
resources_name() click to toggle source
# File lib/fulcrum/resource.rb, line 13
def resources_name
  resource_name.pluralize
end