Class: Arkenstone::Environment
- Inherits:
-
Object
- Object
- Arkenstone::Environment
- 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
-
#body ⇒ Object
Returns the value of attribute body.
-
#headers ⇒ Object
Returns the value of attribute headers.
-
#url ⇒ Object
Returns the value of attribute url.
-
#verb ⇒ Object
Returns the value of attribute verb.
Instance Method Summary collapse
-
#initialize(options) ⇒ Environment
constructor
A new instance of Environment.
- #to_s ⇒ Object
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() .each do |key, value| send("#{key}=".to_sym, value) if respond_to? key end end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
7 8 9 |
# File 'lib/arkenstone/network/env.rb', line 7 def body @body end |
#headers ⇒ Object
Returns the value of attribute headers.
7 8 9 |
# File 'lib/arkenstone/network/env.rb', line 7 def headers @headers end |
#url ⇒ Object
Returns the value of attribute url.
7 8 9 |
# File 'lib/arkenstone/network/env.rb', line 7 def url @url end |
#verb ⇒ Object
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_s ⇒ Object
15 16 17 |
# File 'lib/arkenstone/network/env.rb', line 15 def to_s "#{@verb} #{@url}\n#{@body}" end |