Class: VpsbClient::Api::GetTrialLastMetricRequest

Inherits:
GetRequest show all
Defined in:
lib/vpsb_client/api/get_trial_last_metric_request.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from GetRequest

#run

Methods inherited from Request

#accept, #post_params, #put_params

Constructor Details

#initialize(http_client, params) ⇒ GetTrialLastMetricRequest

Returns a new instance of GetTrialLastMetricRequest.



4
5
6
7
8
# File 'lib/vpsb_client/api/get_trial_last_metric_request.rb', line 4

def initialize(http_client, params)
  super(http_client)
  @trial_id = params[:trial_id]
  @length = params[:length]
end

Class Method Details

.started_at(http_response) ⇒ Object



18
19
20
21
22
# File 'lib/vpsb_client/api/get_trial_last_metric_request.rb', line 18

def self.started_at(http_response)
  return nil if http_response.parsed_response.empty?
  metric = http_response.parsed_response.first
  DateTime.parse(metric['started_at']).to_time
end

Instance Method Details

#query_paramsObject



14
15
16
# File 'lib/vpsb_client/api/get_trial_last_metric_request.rb', line 14

def query_params
  { length: @length  }
end

#url_pathObject



10
11
12
# File 'lib/vpsb_client/api/get_trial_last_metric_request.rb', line 10

def url_path
  "/api/trials/#{@trial_id}/last_metric"
end