Class: Buckaruby::Request

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

Overview

Base class for any request.

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Request

Returns a new instance of Request.



11
12
13
# File 'lib/buckaruby/request.rb', line 11

def initialize(config)
  @config = config
end

Instance Method Details

#build_request_params(_options) ⇒ Object

Returns the request parameters (to be implemented by subclasses).

Raises:

  • (NotImplementedError)


28
29
30
# File 'lib/buckaruby/request.rb', line 28

def build_request_params(_options)
  raise NotImplementedError
end

#execute(options) ⇒ Object



15
16
17
18
19
20
# File 'lib/buckaruby/request.rb', line 15

def execute(options)
  uri = URI.parse(@config.api_url)
  uri.query = URI.encode_www_form(op: operation) if operation

  post_buckaroo(uri, build_request_data(options))
end

#operationObject

Returns the service operation for this request.



23
24
25
# File 'lib/buckaruby/request.rb', line 23

def operation
  nil
end