class OrchestrateIo::Graph

Attributes

http_method[R]
request[R]

Public Class Methods

new(client, method, &block) click to toggle source

Usage

io = OrchestrateIo.new(api_key: “abc”) request = io.graph :get do

collection  'films'
key         'the_godfather'
relation    'sequel'

end

request.perform

> HTTParty::Response

# File lib/orchestrate.io/graph.rb, line 20
def initialize(client, method, &block)
  @http_method = method
  args = {
    client: client,
    http_method: method,
    uri: uri,
    options: options
  }

  @request = OrchestrateIo::Request.new(args, &block)
end

Public Instance Methods

perform() click to toggle source
# File lib/orchestrate.io/graph.rb, line 32
def perform
  request.perform
end

Protected Instance Methods

options() click to toggle source
# File lib/orchestrate.io/graph.rb, line 47
def options
  options = {}
  options
end
uri() click to toggle source
# File lib/orchestrate.io/graph.rb, line 38
def uri
  case http_method
  when :get
    "/:version/:collection/:key/relations/:relation"
  when :put
    "/:version/:collection/:key/relations/:relation/:to_collection/:to_key"
  end
end