Class: Apiphobic::AcceptHeader
- Inherits:
-
Object
- Object
- Apiphobic::AcceptHeader
- Defined in:
- lib/apiphobic/accept_header.rb
Instance Attribute Summary collapse
-
#application_name ⇒ Object
Returns the value of attribute application_name.
-
#raw_accept_header ⇒ Object
Returns the value of attribute raw_accept_header.
Instance Method Summary collapse
- #content_type ⇒ Object
-
#initialize(header, application_name:) ⇒ AcceptHeader
constructor
A new instance of AcceptHeader.
- #invalid? ⇒ Boolean
- #to_s ⇒ Object
- #valid? ⇒ Boolean
- #version ⇒ Object
Constructor Details
#initialize(header, application_name:) ⇒ AcceptHeader
Returns a new instance of AcceptHeader.
8 9 10 11 |
# File 'lib/apiphobic/accept_header.rb', line 8 def initialize(header, application_name:) self.application_name = application_name self.raw_accept_header = header || '' end |
Instance Attribute Details
#application_name ⇒ Object
Returns the value of attribute application_name.
6 7 8 |
# File 'lib/apiphobic/accept_header.rb', line 6 def application_name @application_name end |
#raw_accept_header ⇒ Object
Returns the value of attribute raw_accept_header.
5 6 7 |
# File 'lib/apiphobic/accept_header.rb', line 5 def raw_accept_header @raw_accept_header end |
Instance Method Details
#content_type ⇒ Object
24 25 26 |
# File 'lib/apiphobic/accept_header.rb', line 24 def content_type accept_header_data[1] end |
#invalid? ⇒ Boolean
32 33 34 |
# File 'lib/apiphobic/accept_header.rb', line 32 def invalid? accept_header_data.nil? end |
#to_s ⇒ Object
36 37 38 |
# File 'lib/apiphobic/accept_header.rb', line 36 def to_s raw_accept_header end |
#valid? ⇒ Boolean
28 29 30 |
# File 'lib/apiphobic/accept_header.rb', line 28 def valid? !invalid? end |
#version ⇒ Object
20 21 22 |
# File 'lib/apiphobic/accept_header.rb', line 20 def version accept_header_data[2] end |