Class: Bixby::JsonRequest
- Inherits:
-
Object
- Object
- Bixby::JsonRequest
- Includes:
- HttpClient, Jsonify
- Defined in:
- lib/bixby-common/api/json_request.rb
Overview
Wraps a JSON Request
Direct Known Subclasses
Instance Attribute Summary collapse
-
#operation ⇒ String
Name of operation.
-
#params ⇒ Array
Array of paramters; must be valid JSON types.
Instance Method Summary collapse
-
#initialize(operation, params) ⇒ JsonRequest
constructor
Create a new JsonRequest.
-
#to_s ⇒ String
Convert object to String, useful for debugging.
-
#to_wire ⇒ Object
:nocov:.
Methods included from HttpClient
#http_get, #http_get_json, #http_post, #http_post_download, #http_post_json
Methods included from Jsonify
Methods included from Hashify
Constructor Details
#initialize(operation, params) ⇒ JsonRequest
Create a new JsonRequest
19 20 21 22 |
# File 'lib/bixby-common/api/json_request.rb', line 19 def initialize(operation, params) @operation = operation @params = params end |
Instance Attribute Details
#operation ⇒ String
Name of operation
8 9 10 |
# File 'lib/bixby-common/api/json_request.rb', line 8 def operation @operation end |
#params ⇒ Array
Array of paramters; must be valid JSON types
8 9 10 |
# File 'lib/bixby-common/api/json_request.rb', line 8 def params @params end |
Instance Method Details
#to_s ⇒ String
Convert object to String, useful for debugging
27 28 29 30 31 32 33 |
# File 'lib/bixby-common/api/json_request.rb', line 27 def to_s # :nocov: s = [] s << "JsonRequest:#{self.object_id}" s << " operation: #{self.operation}" s << " params: " + MultiJson.dump(self.params) s.join("\n") end |
#to_wire ⇒ Object
:nocov:
35 36 37 |
# File 'lib/bixby-common/api/json_request.rb', line 35 def to_wire MultiJson.dump(self) end |