Module: Lutaml::Hal::Cache::ResponseAdapter
- Defined in:
- lib/lutaml/hal/cache/response_adapter.rb
Class Method Summary collapse
Class Method Details
.headers(response) ⇒ Object
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/lutaml/hal/cache/response_adapter.rb', line 7 def self.headers(response) case response when Hash response.select { |k, _| k.is_a?(String) && k.match?(/^[a-z-]+$/) } when nil {} else response.headers.to_h end end |
.status_code(response) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/lutaml/hal/cache/response_adapter.rb', line 18 def self.status_code(response) case response when Hash response['status'] || response[:status] || 200 when nil 200 else response.status end rescue NoMethodError 200 end |