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



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

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



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

def post(token, url, body)
  {
    results: {},
    ratelimit_remaining: 600,
    ratelimit_reset_at: Time.now
  }
end