Class: Warden::Client::V1
- Inherits:
-
Object
- Object
- Warden::Client::V1
- Defined in:
- lib/warden/client/v1.rb
Class Method Summary collapse
Class Method Details
.request_from_v1(args) ⇒ Object
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/warden/client/v1.rb', line 6 def self.request_from_v1(args) command = args.shift m = "convert_#{command}_request".downcase if respond_to?(m) send(m, args) else raise "Unknown command: #{command.upcase}" end end |
.response_to_v1(response) ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/warden/client/v1.rb', line 17 def self.response_to_v1(response) klass_name = response.class.name.split("::").last klass_name = klass_name.gsub(/Response$/, "") klass_name = klass_name.gsub(/(.)([A-Z])/) { |m| "#{m[0]}_#{m[1]}" } klass_name = klass_name.downcase m = "convert_#{klass_name}_response".downcase if respond_to?(m) send(m, response) else raise "Unknown response: #{response.class.name.split("::").last}" end end |