Class: HttpRequest
- Inherits:
-
Object
- Object
- HttpRequest
- Defined in:
- lib/models/http_request.rb
Instance Attribute Summary collapse
-
#query ⇒ Object
readonly
Returns the value of attribute query.
Instance Method Summary collapse
- #body ⇒ Object
- #execute ⇒ Object
-
#initialize(node, repository) ⇒ HttpRequest
constructor
A new instance of HttpRequest.
- #method_name ⇒ Object
- #uri ⇒ Object
Constructor Details
#initialize(node, repository) ⇒ HttpRequest
Returns a new instance of HttpRequest.
6 7 8 |
# File 'lib/models/http_request.rb', line 6 def initialize(node, repository) @query = NodeQuery.new(node, repository) end |
Instance Attribute Details
#query ⇒ Object (readonly)
Returns the value of attribute query.
4 5 6 |
# File 'lib/models/http_request.rb', line 4 def query @query end |
Instance Method Details
#body ⇒ Object
14 15 16 |
# File 'lib/models/http_request.rb', line 14 def body query.value(HttpVocabulary.body) end |
#execute ⇒ Object
22 23 24 25 26 |
# File 'lib/models/http_request.rb', line 22 def execute raise "Unsupported method #{method_name}" unless method_name == 'POST' RestClient.post(uri.to_s, body.to_s) true end |
#method_name ⇒ Object
18 19 20 |
# File 'lib/models/http_request.rb', line 18 def method_name query.value(HttpVocabulary.method_name) end |
#uri ⇒ Object
10 11 12 |
# File 'lib/models/http_request.rb', line 10 def uri query.value(HttpVocabulary.request_uri) end |