Class: InvisibleCollector::Resources::CompanyResource

Inherits:
Object
  • Object
show all
Includes:
DefaultHandlers
Defined in:
lib/invisible_collector/resources/company_resource.rb

Instance Method Summary collapse

Methods included from DefaultHandlers

#execute, #execute_get, #execute_post, #handle, #handles

Constructor Details

#initialize(options = {}) ⇒ CompanyResource

Returns a new instance of CompanyResource.



8
9
10
# File 'lib/invisible_collector/resources/company_resource.rb', line 8

def initialize(options = {})
  super(options)
end

Instance Method Details

#disable_notificationsObject



29
30
31
# File 'lib/invisible_collector/resources/company_resource.rb', line 29

def disable_notifications
  build_response(@connection.put('/companies/disableNotifications'))
end

#enable_notificationsObject



25
26
27
# File 'lib/invisible_collector/resources/company_resource.rb', line 25

def enable_notifications
  build_response(@connection.put('/companies/enableNotifications'))
end

#getObject



12
13
14
15
16
17
18
19
# File 'lib/invisible_collector/resources/company_resource.rb', line 12

def get
  response = @connection.get('companies')
  if handles.key? response.status
    handles[response.status].call response
  else
    build_response(response)
  end
end

#update(company) ⇒ Object



21
22
23
# File 'lib/invisible_collector/resources/company_resource.rb', line 21

def update(company)
  build_response(@connection.put('companies', company))
end