Class: RubyKong::Request::Node::Stub

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby-kong/request/node.rb

Class Method Summary collapse

Class Method Details

.get_node_infoObject



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/ruby-kong/request/node.rb', line 19

def self.get_node_info
  url = RubyKong::Utils.endpoint_builder(RubyKong.paths[:node][:info])

  RubyKong::Stub.request(
    :method   => :get,
    :url      => url,
    :response => {
      :body => {
        'version'     => '0.7.0',
        'lua_version' => 'LuaJIT 2.1.0-beta1',
        'tagline'     => 'Welcome to Kong',
        'hostname'    => '8b173da56e6'
      }.to_s
    }
  )
end

.get_node_statusObject



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/ruby-kong/request/node.rb', line 36

def self.get_node_status
  url = RubyKong::Utils.endpoint_builder(RubyKong.paths[:node][:status])

  RubyKong::Stub.request(
    :method   => :get,
    :url      => url,
    :response => {
      :body => {
        "server"   => {
          "connections_handled"  => 2757,
          "connections_reading"  => 0,
          "connections_active"   => 1,
          "connections_waiting"  => 0,
          "connections_writing"  => 1,
          "total_requests"       => 2757,
          "connections_accepted" => 2757
        },
        "database" => {
          "response_ratelimiting_metrics" => 0,
          "keyauth_credentials"           => 0,
          "apis"                          => 0,
          "consumers"                     => 0,
          "plugins"                       => 0,
          "nodes"                         => 1,
          "basicauth_credentials"         => 0,
          "ratelimiting_metrics"          => 0
        }
      }.to_s
    }
  )
end