class Wrappi::Request

Attributes

endpoint[R]

Public Class Methods

new(endpoint) click to toggle source
# File lib/wrappi/request.rb, line 4
def initialize(endpoint)
  @endpoint = endpoint
end

Public Instance Methods

call() click to toggle source
# File lib/wrappi/request.rb, line 23
def call
  @call ||= strategy.call
end
Also aliased as: http
http()
Alias for: call
strategy() click to toggle source
# File lib/wrappi/request.rb, line 12
def strategy
  @strategy ||= case verb
                when :get
                  Get.new(endpoint)
                when :post, :delete, :put
                  WithBody.new(endpoint)
                else
                  raise 'Verb strategy not defined'
                end
end
to_h() click to toggle source
# File lib/wrappi/request.rb, line 28
def to_h
  @to_h ||= {
    raw_body: http.raw_body,
    code: http.code,
    uri: http.uri
  }
end
verb() click to toggle source
# File lib/wrappi/request.rb, line 8
def verb
  endpoint.verb
end