Class: Gorillapi::RequestBuilder

Inherits:
Object
  • Object
show all
Includes:
CurlBuilder
Defined in:
lib/gorillapi/request_builder.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from CurlBuilder

#accept, #add_params, #authorization, #content_header, #host, #request_string

Constructor Details

#initialize(options = {}) ⇒ RequestBuilder

Returns a new instance of RequestBuilder.



7
8
9
10
11
# File 'lib/gorillapi/request_builder.rb', line 7

def initialize(options = {})
  options.each do |key, value|
    instance_variable_set("@#{key}", value) unless value.nil? || value.empty?
  end
end

Instance Attribute Details

#accept_headerObject (readonly)

Returns the value of attribute accept_header.



5
6
7
# File 'lib/gorillapi/request_builder.rb', line 5

def accept_header
  @accept_header
end

#content_typeObject (readonly)

Returns the value of attribute content_type.



5
6
7
# File 'lib/gorillapi/request_builder.rb', line 5

def content_type
  @content_type
end

#paramsObject (readonly)

Returns the value of attribute params.



5
6
7
# File 'lib/gorillapi/request_builder.rb', line 5

def params
  @params
end

#pathObject (readonly)

Returns the value of attribute path.



5
6
7
# File 'lib/gorillapi/request_builder.rb', line 5

def path
  @path
end

#request_methodObject (readonly)

Returns the value of attribute request_method.



5
6
7
# File 'lib/gorillapi/request_builder.rb', line 5

def request_method
  @request_method
end

#tokenObject (readonly)

Returns the value of attribute token.



5
6
7
# File 'lib/gorillapi/request_builder.rb', line 5

def token
  @token
end

#urlObject (readonly)

Returns the value of attribute url.



5
6
7
# File 'lib/gorillapi/request_builder.rb', line 5

def url
  @url
end

Instance Method Details



17
18
19
# File 'lib/gorillapi/request_builder.rb', line 17

def print
  request_string
end

#sendObject



13
14
15
# File 'lib/gorillapi/request_builder.rb', line 13

def send
  `#{request_string}`
end