Class: Rubycent::Query
- Inherits:
-
Object
- Object
- Rubycent::Query
- Defined in:
- lib/rubycent/query.rb
Overview
Rubycent::Query
Centrifugo API request configuration and execution
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
Instance Method Summary collapse
-
#execute(method, data) ⇒ Hash
Perform centrifugo API call.
-
#initialize(client) ⇒ Query
constructor
A new instance of Query.
Constructor Details
#initialize(client) ⇒ Query
Returns a new instance of Query.
18 19 20 |
# File 'lib/rubycent/query.rb', line 18 def initialize(client) @client = client end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
13 14 15 |
# File 'lib/rubycent/query.rb', line 13 def client @client end |
Instance Method Details
#execute(method, data) ⇒ Hash
Perform centrifugo API call
34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/rubycent/query.rb', line 34 def execute(method, data) body = dump_body(method, data) params = { timeout: client.timeout, open_timeout: client.open_timeout } headers = build_headers(client.api_key) endpoint = build_endpoint(client.host, client.port, client.scheme.to_s) Rubycent::Request.new(endpoint, params, body, headers).post end |