Class: Contactually::API

Inherits:
Object
  • Object
show all
Defined in:
lib/contactually.rb

Instance Method Summary collapse

Constructor Details

#initialize(api_key, headers = {}) ⇒ API

Returns a new instance of API.



7
8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/contactually.rb', line 7

def initialize(api_key, headers = {} )
  @api_key = api_key

  # The Contactually API recommends passing in a User-Agent header unique to
  # the client application as a best practice
  # (see: http://developers.contactually.com/docs/):
  #
  #     Contactually::API.new(
  #         { "YOUR_CONTACTUALLY_API_KEY", :user_agent => "YOUR_APP_NAME" }
  #     )
  #
  @headers = headers
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args) ⇒ Object



26
27
28
# File 'lib/contactually.rb', line 26

def method_missing(method, *args)
  call(method, args)
end

Instance Method Details

#call(method, args) ⇒ Object



21
22
23
24
# File 'lib/contactually.rb', line 21

def call(method, args)
  parsed_response = make_call(method, args)
  parsed_response
end