Class: Request
- Inherits:
-
Object
- Object
- Request
- Defined in:
- lib/request.rb
Instance Attribute Summary collapse
-
#additional_headers ⇒ Object
Returns the value of attribute additional_headers.
-
#body ⇒ Object
Returns the value of attribute body.
-
#host ⇒ Object
Returns the value of attribute host.
-
#path ⇒ Object
Returns the value of attribute path.
-
#point ⇒ Object
Returns the value of attribute point.
-
#private_key_path ⇒ Object
Returns the value of attribute private_key_path.
Instance Method Summary collapse
- #confirm ⇒ Object
-
#initialize {|_self| ... } ⇒ Request
constructor
A new instance of Request.
Constructor Details
#initialize {|_self| ... } ⇒ Request
Returns a new instance of Request.
8 9 10 11 12 13 14 15 16 |
# File 'lib/request.rb', line 8 def initialize(&block) yield self @headers = { "Content-Type" => "text/plain; charset=Windows-1251", "Content-Length" => @body.size.to_s, "X-Eport-Auth" => "point=#{@point}; sign=\"#{signature(@body)}\"; encoding=\"hex\"" }.merge(additional_headers || {}) end |
Instance Attribute Details
#additional_headers ⇒ Object
Returns the value of attribute additional_headers.
6 7 8 |
# File 'lib/request.rb', line 6 def additional_headers @additional_headers end |
#body ⇒ Object
Returns the value of attribute body.
6 7 8 |
# File 'lib/request.rb', line 6 def body @body end |
#host ⇒ Object
Returns the value of attribute host.
6 7 8 |
# File 'lib/request.rb', line 6 def host @host end |
#path ⇒ Object
Returns the value of attribute path.
6 7 8 |
# File 'lib/request.rb', line 6 def path @path end |
#point ⇒ Object
Returns the value of attribute point.
6 7 8 |
# File 'lib/request.rb', line 6 def point @point end |
#private_key_path ⇒ Object
Returns the value of attribute private_key_path.
6 7 8 |
# File 'lib/request.rb', line 6 def private_key_path @private_key_path end |
Instance Method Details
#confirm ⇒ Object
18 19 20 21 22 23 24 25 |
# File 'lib/request.rb', line 18 def confirm http = Net::HTTP.new(@host, 443) http.use_ssl = true http.verify_mode = OpenSSL::SSL::VERIFY_NONE puts @headers.inspect resp, data = http.post(@path, @body, @headers) data end |