Class: Poms::Api::Request

Inherits:
Object
  • Object
show all
Defined in:
lib/poms/api/request.rb

Overview

A request to the Poms API. Does the authentication and allows you to execute the request.

Instance Method Summary collapse

Constructor Details

#initialize(uri, key, secret, origin) ⇒ Request

Create a new request to the Poms API. The request is initialized with a URI to be called and the key, secret and origin that are needed for authentication.

Parameters:

  • uri

    The full URI to call on the Poms API

  • key

    The api key

  • secret

    The secret that goes with the api key

  • origin

    The whitelisted origin for this api key



16
17
18
19
20
21
22
# File 'lib/poms/api/request.rb', line 16

def initialize(uri, key, secret, origin)
  @uri = uri
  @path = URI(@uri).path
  @key = key
  @secret = secret
  @origin = origin
end

Instance Method Details

#callObject

Executes the request.



25
26
27
# File 'lib/poms/api/request.rb', line 25

def call
  open(@uri, headers)
end