Class: Pusher::Resource

Inherits:
Object
  • Object
show all
Defined in:
lib/pusher/resource.rb

Instance Method Summary collapse

Constructor Details

#initialize(client, path) ⇒ Resource

Returns a new instance of Resource.



3
4
5
6
# File 'lib/pusher/resource.rb', line 3

def initialize(client, path)
  @client = client
  @path = path
end

Instance Method Details

#get(params) ⇒ Object



8
9
10
# File 'lib/pusher/resource.rb', line 8

def get(params)
  create_request(:get, params).send_sync
end

#get_async(params) ⇒ Object



12
13
14
# File 'lib/pusher/resource.rb', line 12

def get_async(params)
  create_request(:get, params).send_async
end

#post(params) ⇒ Object



16
17
18
19
# File 'lib/pusher/resource.rb', line 16

def post(params)
  body = MultiJson.encode(params)
  create_request(:post, {}, body).send_sync
end

#post_async(params) ⇒ Object



21
22
23
24
# File 'lib/pusher/resource.rb', line 21

def post_async(params)
  body = MultiJson.encode(params)
  create_request(:post, {}, body).send_async
end