Class: HiuHttp

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(base_url, uri, method, headers, options = {}) ⇒ HiuHttp

Returns a new instance of HiuHttp.



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/hiu_http.rb', line 6

def initialize(base_url, uri, method, headers, options = {})
  Excon.defaults[:ssl_verify_peer] = false
  @method = method
  @connection = Excon.new(
    base_url + uri,
    headers:     headers,
    body:        URI.encode_www_form(options),
    tcp_nodelay: true,
    nonblock:    false,
  )
end

Instance Attribute Details

#connectionObject (readonly)

Returns the value of attribute connection.



4
5
6
# File 'lib/hiu_http.rb', line 4

def connection
  @connection
end

#methodObject (readonly)

Returns the value of attribute method.



4
5
6
# File 'lib/hiu_http.rb', line 4

def method
  @method
end

Instance Method Details

#callObject



18
19
20
# File 'lib/hiu_http.rb', line 18

def call
  connection.request(method: method)
end