class InvisibleCollector::Resources::CompanyResource
Public Class Methods
new(options = {})
click to toggle source
Calls superclass method
InvisibleCollector::DefaultHandlers::new
# File lib/invisible_collector/resources/company_resource.rb, line 8 def initialize(options = {}) super(options) end
Public Instance Methods
disable_notifications()
click to toggle source
# File lib/invisible_collector/resources/company_resource.rb, line 29 def disable_notifications build_response(@connection.put('/companies/disableNotifications')) end
enable_notifications()
click to toggle source
# File lib/invisible_collector/resources/company_resource.rb, line 25 def enable_notifications build_response(@connection.put('/companies/enableNotifications')) end
get()
click to toggle source
# 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)
click to toggle source
# File lib/invisible_collector/resources/company_resource.rb, line 21 def update(company) build_response(@connection.put('companies', company)) end
Private Instance Methods
build_response(response)
click to toggle source
# File lib/invisible_collector/resources/company_resource.rb, line 35 def build_response(response) company = Model::Company.new(JSON.parse(response.body).deep_transform_keys(&:underscore)) Response.new(response, company) end