Class: RubyKong::Request::Consumer::Stub
- Inherits:
-
Object
- Object
- RubyKong::Request::Consumer::Stub
- Defined in:
- lib/ruby-kong/request/consumer.rb
Class Method Summary collapse
Class Method Details
.create ⇒ Object
118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 |
# File 'lib/ruby-kong/request/consumer.rb', line 118 def self.create url = RubyKong::Utils.endpoint_builder(RubyKong.paths[:consumer][:create]) RubyKong::Stub.request( :method => :post, :url => url, :request => { :body => { :username => 'lamdt' } }, :response => { :status => 201, :body => { 'username' => 'lamdt', 'created_at' => 1458789832000, 'id' => 'b880f403-b161-4294-9a13-2462d39991b2' }.to_s } ) end |
.delete ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/ruby-kong/request/consumer.rb', line 35 def self.delete # Mock with /consumers/lamdt path path = RubyKong.paths[:consumer][:delete] + 'lamdt' url = RubyKong::Utils.endpoint_builder(path) RubyKong::Stub.request( :method => :delete, :url => url, :response => { :status => 204, :body => "" } ) end |
.list ⇒ Object
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/ruby-kong/request/consumer.rb', line 95 def self.list url = RubyKong::Utils.endpoint_builder(RubyKong.paths[:consumer][:list]) RubyKong::Stub.request( :method => :get, :url => url, :response => { :status => 200, :body => { "data" => [ { 'username' => 'lamdt', 'created_at' => 1458789832000, 'id' => 'b880f403-b161-4294-9a13-2462d39991b2' } ], "total" => 1 }.to_s } ) end |
.retrieve ⇒ Object
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/ruby-kong/request/consumer.rb', line 76 def self.retrieve # Mock with /consumers/lamdt path path = RubyKong.paths[:consumer][:retrieve] + 'lamdt' url = RubyKong::Utils.endpoint_builder(path) RubyKong::Stub.request( :method => :get, :url => url, :response => { :status => 200, :body => { 'username' => 'lamdt', 'created_at' => 1458789832000, 'id' => 'b880f403-b161-4294-9a13-2462d39991b2' }.to_s } ) end |
.update ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/ruby-kong/request/consumer.rb', line 50 def self.update # Mock with /consumers/lamdt path path = RubyKong.paths[:consumer][:update] + 'lamdt' url = RubyKong::Utils.endpoint_builder(path) RubyKong::Stub.request( :method => :patch, :url => url, :request => { :body => { :custom_id => '1234', :username => 'lamdt' } }, :response => { :status => 200, :body => { 'custom_id' => 1234, 'username' => 'lamdt', 'created_at' => 1458789832000, 'id' => 'b880f403-b161-4294-9a13-2462d39991b2' }.to_s } ) end |