Class: DbBot::Translate

Inherits:
Object
  • Object
show all
Defined in:
lib/db_bot/translate.rb

Defined Under Namespace

Classes: TranslateException

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message) ⇒ Translate

Returns a new instance of Translate.



21
22
23
# File 'lib/db_bot/translate.rb', line 21

def initialize(message)
  @message = message
end

Instance Attribute Details

#collectionObject

Returns the value of attribute collection.



7
8
9
# File 'lib/db_bot/translate.rb', line 7

def collection
  @collection
end

#numberObject

Returns the value of attribute number.



7
8
9
# File 'lib/db_bot/translate.rb', line 7

def number
  @number
end

#queryObject

Returns the value of attribute query.



7
8
9
# File 'lib/db_bot/translate.rb', line 7

def query
  @query
end

#responseObject

Returns the value of attribute response.



7
8
9
# File 'lib/db_bot/translate.rb', line 7

def response
  @response
end

#search_queryObject

Returns the value of attribute search_query.



7
8
9
# File 'lib/db_bot/translate.rb', line 7

def search_query
  @search_query
end

#tableObject

Returns the value of attribute table.



7
8
9
# File 'lib/db_bot/translate.rb', line 7

def table
  @table
end

#target_attributeObject

Returns the value of attribute target_attribute.



7
8
9
# File 'lib/db_bot/translate.rb', line 7

def target_attribute
  @target_attribute
end

#verbObject

Returns the value of attribute verb.



7
8
9
# File 'lib/db_bot/translate.rb', line 7

def verb
  @verb
end

#whenObject

Returns the value of attribute when.



7
8
9
# File 'lib/db_bot/translate.rb', line 7

def when
  @when
end

Class Method Details

.perform(*args) ⇒ Object



17
18
19
# File 'lib/db_bot/translate.rb', line 17

def self.perform(*args)
  return new(*args).tap { |use_case| use_case.perform }
end

Instance Method Details

#performObject



25
26
27
28
29
30
31
32
33
34
# File 'lib/db_bot/translate.rb', line 25

def perform
  init_wit_client

  construct_entities

  process_verb

rescue TranslateException => e
  @response = e.message
end