Class: ApiAiWrapper::Components::TrainerComponent

Inherits:
Component show all
Defined in:
lib/api_ai_wrapper/components/trainer_component.rb

Instance Attribute Summary

Attributes inherited from Component

#engine

Instance Method Summary collapse

Instance Method Details

#raise_if_unauthorizedObject



4
5
6
# File 'lib/api_ai_wrapper/components/trainer_component.rb', line 4

def raise_if_unauthorized
  raise ApiAiWrapper::Errors::Engine::MissingToken.new("developer token is missing") if self.engine.developer_token.blank?
end

#set_headersObject



8
9
10
11
12
13
# File 'lib/api_ai_wrapper/components/trainer_component.rb', line 8

def set_headers
  self.engine.headers = {
    "Authorization" => "Bearer #{self.engine.developer_token}",
    "Content-Type" => "application/json; charset=utf-8"
  }
end