Sha256: 14e9d9ca6bdeedfc5ccca4addd3ea6196f5c04be59f370e9309b7cbac31eea0b

Contents?: true

Size: 700 Bytes

Versions: 3

Compression:

Stored size: 700 Bytes

Contents

module Eventflit
  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

3 entries across 3 versions & 1 rubygems

Version Path
eventflit-0.1.2 lib/eventflit/resource.rb
eventflit-0.1.1 lib/eventflit/resource.rb
eventflit-0.1.0 lib/eventflit/resource.rb