Module: YellowApi::Client::Request

Included in:
YellowApi::Client
Defined in:
lib/yellow_api/client/request.rb

Instance Method Summary collapse

Instance Method Details

#get(path, options = {}) ⇒ Object



13
14
15
16
17
18
19
20
21
# File 'lib/yellow_api/client/request.rb', line 13

def get(path, options={})
  # stuff that's sent with every request
  # but define by api initialization
  options[:apikey] = apikey
  options[:fmt] = fmt
  options[:UID] = uid
  
  request(:get, path, options)
end

#request(method, path, options) ⇒ Object



23
24
25
26
27
28
# File 'lib/yellow_api/client/request.rb', line 23

def request(method, path, options)
  response = connection.send(method) do |request|
    request.url(path, options)
  end
  response.body
end

#uidObject

generates a UUID for a given instance



9
10
11
# File 'lib/yellow_api/client/request.rb', line 9

def uid
  @uid ||= UUID.new.generate(:compact)
end