Class: Clarification::TrainResponse

Inherits:
Response
  • Object
show all
Defined in:
lib/clarification/response/train_response.rb

Instance Method Summary collapse

Constructor Details

#initialize(raw_response) ⇒ TrainResponse

Returns a new instance of TrainResponse.


5
6
7
# File 'lib/clarification/response/train_response.rb', line 5

def initialize(raw_response)
  @raw_response = JSON.parse(raw_response)
end

Instance Method Details

#create_modelObject


9
10
11
12
13
14
# File 'lib/clarification/response/train_response.rb', line 9

def create_model
  if @raw_response['status']['code'] == 10000
    Model.new(id: @raw_response['model']['id'],
      name: @raw_response['model']['name'])
  end
end

#train_modelObject


16
17
18
19
20
21
# File 'lib/clarification/response/train_response.rb', line 16

def train_model
  if @raw_response['status']['code'] == 10000
    Model.new(id: @raw_response['model']['id'],
      name: @raw_response['model']['name'])
  end
end