GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.

OptimizationProblem.optimize()   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 8

Duplication

Lines 8
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
c 1
b 0
f 0
dl 8
loc 8
rs 9.4285
1
module Route4me
2
  class OptimizationProblem
3
    def self.url
4
      '/api.v4/optimization_problem.php'
5
    end
6
7
    def self.get(params={})
8
      get = Util.extract(params, [
9
        :optimization_problem_id, :wait_for_final_state,
10
        :state, :limit, :offset
11
      ])
12
13
      optimization = Route4me.request(:get, self.url, get: get)
14
      if (optimization[:optimizations]).nil?
15
        optimization
16
      else
17
        optimization[:optimizations]
18
      end
19
    end
20
21 View Code Duplication
    def self.optimize(params={})
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
22
      json = Util.extract(params, [:addresses, :parameters])
23
      get = Util.extract(params, [
24
        :directions, :format, :route_path_output, :optimized_callback_url
25
      ])
26
27
      Route4me.request(:post, self.url, get: get, json: json)
28
    end
29
30 View Code Duplication
    def self.update(params={})
0 ignored issues
show
Duplication introduced by
This code seems to be duplicated in your project.
Loading history...
31
      json = Util.extract(params, [:addresses, :parameters])
32
      get = Util.extract(params, [
33
        :optimization_problem_id, :directions, :format,
34
        :route_path_output, :reoptimize
35
      ])
36
37
      Route4me.request(:post, self.url, get: get, json: json)
38
    end
39
  end
40
end
41