Class: Appilf::Client

Inherits:
Object
  • Object
show all
Includes:
APIActions, Authentication, Alerts, DomainTraits, SavedSearches, Users, WatchedItems
Defined in:
lib/appilf/client.rb,
lib/appilf/client/users.rb,
lib/appilf/client/alerts.rb,
lib/appilf/client/domain_traits.rb,
lib/appilf/client/watched_items.rb,
lib/appilf/client/saved_searches.rb

Defined Under Namespace

Modules: Alerts, DomainTraits, SavedSearches, Users, WatchedItems

Constant Summary

Constants included from Authentication

Authentication::PATH

Constants included from APIActions

APIActions::BASE_API_URL

Instance Attribute Summary

Attributes included from Authentication

#access_token, #password, #token_type, #user, #username

Instance Method Summary collapse

Methods included from WatchedItems

#create_watched_item, #delete_watched_item, #watched_items_path

Methods included from SavedSearches

#delete_saved_search, #list_saved_searches, #saved_searches_path

Methods included from DomainTraits

#domain_traits_path, #list_domain_traits

Methods included from Alerts

#alerts_path, #list_alerts

Methods included from Users

#retrieve_user, #users_path

Methods included from Authentication

#authenticate, #authenticated_user_path, #authentication_headers

Methods included from APIActions

#api_delete, #api_get, #api_post, #handle_from_response

Constructor Details

#initialize(opts = {}) ⇒ Client

Returns a new instance of Client.



18
19
20
21
22
23
24
25
# File 'lib/appilf/client.rb', line 18

def initialize(opts={})
  opts.each_pair do |key, val|
    instance_variable_set(:"@#{key}", val)
  end
  authenticate if opts && !opts[:access_token]
  self.user = retrieve_user
  self
end

Instance Method Details

#authenticated_api_delete(path, payload, headers = {}) ⇒ Object



35
36
37
# File 'lib/appilf/client.rb', line 35

def authenticated_api_delete(path, payload, headers = {})
  api_delete(path, payload, headers.merge(authentication_headers))
end

#authenticated_api_get(path, headers = {}) ⇒ Object



27
28
29
# File 'lib/appilf/client.rb', line 27

def authenticated_api_get(path, headers = {})
  api_get(path, headers.merge(authentication_headers))
end

#authenticated_api_post(path, payload, headers = {}) ⇒ Object



31
32
33
# File 'lib/appilf/client.rb', line 31

def authenticated_api_post(path, payload, headers = {})
  api_post(path, payload, headers.merge(authentication_headers))
end