Class: Model::HttpRequest
- Inherits:
-
Object
- Object
- Model::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.
7 8 9 |
# File 'lib/models/http_request.rb', line 7 def initialize(node, repository) @query = NodeQuery.new(node, repository) end |
Instance Attribute Details
#query ⇒ Object (readonly)
Returns the value of attribute query.
5 6 7 |
# File 'lib/models/http_request.rb', line 5 def query @query end |
Instance Method Details
#body ⇒ Object
15 16 17 |
# File 'lib/models/http_request.rb', line 15 def body query.value(HttpVocabulary.body) end |
#execute ⇒ Object
23 24 25 26 27 |
# File 'lib/models/http_request.rb', line 23 def execute raise "Unsupported method #{method_name}" unless method_name == 'POST' RestClient.post(uri.to_s, body.to_s) true end |
#method_name ⇒ Object
19 20 21 |
# File 'lib/models/http_request.rb', line 19 def method_name query.value(HttpVocabulary.method_name) end |
#uri ⇒ Object
11 12 13 |
# File 'lib/models/http_request.rb', line 11 def uri query.value(HttpVocabulary.request_uri) end |