Module: BaseModules::Methods

Included in:
IAuditor::Actions, IAuditor::Audit, IAuditor::Base, IAuditor::Export, IAuditor::Template
Defined in:
lib/iAuditor/base_modules.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



21
22
23
24
25
# File 'lib/iAuditor/base_modules.rb', line 21

def self.included(base)
  # "HTTParty".constantize does not support in plain ruby -- If you have ActiveSupport loaded (e.g. in Rails) you can use
  base.send :include, Object.const_get("HTTParty")
  base.send(:base_uri, "https://api.safetyculture.io")
end

Instance Method Details

#initialize(token) ⇒ Object



6
7
8
9
10
11
12
13
14
15
# File 'lib/iAuditor/base_modules.rb', line 6

def initialize(token)
  @options = token.is_a?(String) ? {
      headers: {
          "Content-Type" => "application/json",
          "Authorization"=> "Bearer #{token}"
      }
  }
  : token

end