Class: Venn::Services::Api

Inherits:
Object
  • Object
show all
Defined in:
lib/venn/services/api.rb

Constant Summary collapse

KEYS_ENDPOINT =
"http://api.getvenn.io/v1/keys"
PRIORITY_ENDPOINT =
"http://api.getvenn.io/v1/priority"

Instance Method Summary collapse

Constructor Details

#initialize(opts) ⇒ Api

Returns a new instance of Api.



8
9
10
# File 'lib/venn/services/api.rb', line 8

def initialize(opts)
  @api_key = opts[:api_key]
end

Instance Method Details

#get_keysObject



12
13
14
15
16
# File 'lib/venn/services/api.rb', line 12

def get_keys
  opts = { :params => { :type => 'email' }, 'venn-api-key' => @api_key }
  res = RestClient.get Venn::Services::Api::KEYS_ENDPOINT, opts
  MultiJson.load res, :symbolize_keys => true
end

#get_priorityObject



18
19
20
21
22
# File 'lib/venn/services/api.rb', line 18

def get_priority
  opts = { :params => { :type => 'email' }, 'venn-api-key' => @api_key }
  res = RestClient.get Venn::Services::Api::PRIORITY_ENDPOINT, opts
  MultiJson.load res, :symbolize_keys => true
end