Class: Arkenstone::Environment

Inherits:
Object
  • Object
show all
Defined in:
lib/arkenstone/network/env.rb

Overview

Environment is a wrapper around most of the properties created in a network request. A raw net/http object doesn’t allow for much customization after it is instantiated. This allows the caller to manipulate data via hooks before a request is created.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Environment

Returns a new instance of Environment.



9
10
11
12
13
# File 'lib/arkenstone/network/env.rb', line 9

def initialize(options)
  options.each do |key, value|
    send("#{key}=".to_sym, value) if respond_to? key
  end
end

Instance Attribute Details

#bodyObject

Returns the value of attribute body.



7
8
9
# File 'lib/arkenstone/network/env.rb', line 7

def body
  @body
end

#headersObject

Returns the value of attribute headers.



7
8
9
# File 'lib/arkenstone/network/env.rb', line 7

def headers
  @headers
end

#urlObject

Returns the value of attribute url.



7
8
9
# File 'lib/arkenstone/network/env.rb', line 7

def url
  @url
end

#verbObject

Returns the value of attribute verb.



7
8
9
# File 'lib/arkenstone/network/env.rb', line 7

def verb
  @verb
end

Instance Method Details

#to_sObject



15
16
17
# File 'lib/arkenstone/network/env.rb', line 15

def to_s
  "#{@verb} #{@url}\n#{@body}"
end