Class: Mashery::RpcClient

Inherits:
Object
  • Object
show all
Defined in:
lib/mashery/rpc_client.rb,
lib/mashery/rpc_client/base.rb,
lib/mashery/rpc_client/response.rb

Defined Under Namespace

Classes: Base, Response

Instance Method Summary collapse

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

#configObject



3
4
5
# File 'lib/mashery/rpc_client.rb', line 3

def config
  Mashery.config
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_urlObject 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