Class: Gitlab::Triage::NetworkAdapters::TestAdapter

Inherits:
BaseAdapter
  • Object
show all
Defined in:
lib/gitlab/triage/network_adapters/test_adapter.rb

Constant Summary

Constants inherited from BaseAdapter

BaseAdapter::USER_AGENT

Instance Attribute Summary

Attributes inherited from BaseAdapter

#options

Instance Method Summary collapse

Methods inherited from BaseAdapter

#initialize

Constructor Details

This class inherits a constructor from Gitlab::Triage::NetworkAdapters::BaseAdapter

Instance Method Details

#get(_token, url) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/gitlab/triage/network_adapters/test_adapter.rb', line 11

def get(_token, url)
  results =
    case url
    when %r{\Ahttps://gitlab.com/v4/issues?per_page=100}
      [
        { id: 1, title: 'First issue' }
      ]
    else
      []
    end

  {
    more_pages: false,
    next_page_url: nil,
    results: results,
    ratelimit_remaining: 600,
    ratelimit_reset_at: Time.now
  }
end

#post(_token, _url, _body) ⇒ Object



31
32
33
34
35
36
37
# File 'lib/gitlab/triage/network_adapters/test_adapter.rb', line 31

def post(_token, _url, _body)
  {
    results: {},
    ratelimit_remaining: 600,
    ratelimit_reset_at: Time.now
  }
end