Sha256: 3ca4933341e67a79fe31f18fc3572bf6815402f66a8337c1c97b5df7ad6f85b1

Contents?: true

Size: 697 Bytes

Versions: 74

Compression:

Stored size: 697 Bytes

Contents

module Pusher
  class Resource
    def initialize(client, path)
      @client = client
      @path = path
    end

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

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

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

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

    private

    def create_request(verb, params, body = nil)
      Request.new(@client, verb, url, params, body)
    end

    def url
      @_url ||= @client.url(@path)
    end
  end
end

Version data entries

74 entries across 74 versions & 2 rubygems

Version Path
pusher-2.0.3 lib/pusher/resource.rb
pusher-2.0.2 lib/pusher/resource.rb
pusher-2.0.1 lib/pusher/resource.rb
pusher-2.0.0 lib/pusher/resource.rb
pusher-1.4.3 lib/pusher/resource.rb
pusher-1.4.2 lib/pusher/resource.rb
pusher-1.4.1 lib/pusher/resource.rb
pusher-1.4.0 lib/pusher/resource.rb
scout-5.9.13 vendor/pusher/lib/pusher/resource.rb
pusher-1.3.3 lib/pusher/resource.rb
pusher-1.3.2 lib/pusher/resource.rb
scout-5.9.12 vendor/pusher/lib/pusher/resource.rb
scout-5.9.11 vendor/pusher/lib/pusher/resource.rb
pusher-1.3.1 lib/pusher/resource.rb
pusher-1.3.0 lib/pusher/resource.rb
pusher-1.2.1 lib/pusher/resource.rb
pusher-1.2.0 lib/pusher/resource.rb
pusher-1.2.0.rc4 lib/pusher/resource.rb
pusher-1.2.0.rc3 lib/pusher/resource.rb
pusher-1.2.0.rc2 lib/pusher/resource.rb