class RealPush::Resource

Public Class Methods

new(client, path) click to toggle source
# File lib/realpush/resource.rb, line 3
def initialize(client, path)
  @client = client
  @path = path
end

Public Instance Methods

get(params) click to toggle source
# File lib/realpush/resource.rb, line 8
def get(params)
  create_request(:get, params).send_sync
end
get_async(params) click to toggle source
# File lib/realpush/resource.rb, line 12
def get_async(params)
  create_request(:get, params).send_async
end
post(body) click to toggle source
# File lib/realpush/resource.rb, line 16
def post(body)
  body = MultiJson.encode(body) unless body.is_a? String
  create_request(:post, {}, body).send_sync
end
post_async(body) click to toggle source
# File lib/realpush/resource.rb, line 21
def post_async(body)
  body = MultiJson.encode(body) unless body.is_a? String
  create_request(:post, {}, body).send_async
end

Private Instance Methods

create_request(verb, params, body = nil) click to toggle source
# File lib/realpush/resource.rb, line 28
def create_request(verb, params, body = nil)
  Request.new(@client, verb, url, params, body)
end
url() click to toggle source
# File lib/realpush/resource.rb, line 32
def url
  @_url ||= @client.url(@path)
end