Class: Mashery::RpcClient
- Inherits:
-
Object
- Object
- Mashery::RpcClient
- Defined in:
- lib/mashery/rpc_client.rb,
lib/mashery/rpc_client/base.rb,
lib/mashery/rpc_client/response.rb
Defined Under Namespace
Instance Method Summary collapse
- #call_remote(method, opts = {}) ⇒ Object
- #config ⇒ Object
-
#create(type, params) ⇒ Object
Create an object.
-
#echo(value) ⇒ Object
Test Mashery API with echo service.
- #full_url ⇒ Object (also: #url)
-
#query(string) ⇒ Object
Use the Mashery query language to grab data.
- #query_builder(klass) ⇒ Object
Instance Method Details
#call_remote(method, opts = {}) ⇒ Object
27 28 29 |
# File 'lib/mashery/rpc_client.rb', line 27 def call_remote(method, opts = {}) perform('method' => method, 'params' => Array(opts[:params]), 'id' => 1) end |
#create(type, params) ⇒ Object
Create an object
22 23 24 25 |
# File 'lib/mashery/rpc_client.rb', line 22 def create(type, params) # TODO: Handle params! call_remote [type_name, "create"].join('.') end |
#echo(value) ⇒ Object
Test Mashery API with echo service
8 9 10 |
# File 'lib/mashery/rpc_client.rb', line 8 def echo(value) call_remote('test.echo', value) end |
#full_url ⇒ Object Also known as: url
31 32 33 |
# File 'lib/mashery/rpc_client.rb', line 31 def full_url build_url(config.site_id, config.key, config.signature) end |
#query(string) ⇒ Object
Use the Mashery query language to grab data
17 18 19 |
# File 'lib/mashery/rpc_client.rb', line 17 def query(string) call_remote("object.query", params: string) end |
#query_builder(klass) ⇒ Object
12 13 14 |
# File 'lib/mashery/rpc_client.rb', line 12 def query_builder(klass) Mashery::QueryBuilder.new(klass) end |