Class: SimpleOAuth::Parser Private
- Inherits:
-
Object
- Object
- SimpleOAuth::Parser
- Defined in:
- lib/simple_oauth/parser.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Parses OAuth Authorization headers
Constant Summary collapse
- PARAM_PATTERN =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
Pattern to match OAuth key-value pairs: key="value"
/(\w+)="([^"]*)"\s*(,?)\s*/- OAUTH_PREFIX =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
OAuth scheme prefix
/OAuth\s+/
Instance Attribute Summary collapse
-
#attributes ⇒ Hash{Symbol => String}
readonly
private
The parsed OAuth attributes.
-
#scanner ⇒ StringScanner
readonly
private
The StringScanner instance for parsing the header.
Instance Method Summary collapse
-
#initialize(header) ⇒ Parser
constructor
private
Creates a new Parser for the given header string.
-
#parse(valid_keys) ⇒ Hash{Symbol => String}
private
Parses the OAuth Authorization header.
Constructor Details
#initialize(header) ⇒ Parser
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Creates a new Parser for the given header string
29 30 31 32 |
# File 'lib/simple_oauth/parser.rb', line 29 def initialize(header) @scanner = StringScanner.new(header.to_s) @attributes = {} end |
Instance Attribute Details
#attributes ⇒ Hash{Symbol => String} (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The parsed OAuth attributes
23 24 25 |
# File 'lib/simple_oauth/parser.rb', line 23 def attributes @attributes end |
#scanner ⇒ StringScanner (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The StringScanner instance for parsing the header
18 19 20 |
# File 'lib/simple_oauth/parser.rb', line 18 def scanner @scanner end |
Instance Method Details
#parse(valid_keys) ⇒ Hash{Symbol => String}
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Parses the OAuth Authorization header
39 40 41 42 43 44 |
# File 'lib/simple_oauth/parser.rb', line 39 def parse(valid_keys) scan_oauth_prefix scan_params(valid_keys) verify_complete attributes end |