Class: Lorkhan::Request
- Inherits:
-
Object
- Object
- Lorkhan::Request
- Defined in:
- lib/lorkhan/request.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
Instance Method Summary collapse
-
#initialize(notification) ⇒ Request
constructor
A new instance of Request.
- #validate! ⇒ Object
Constructor Details
#initialize(notification) ⇒ Request
Returns a new instance of Request.
7 8 9 10 11 |
# File 'lib/lorkhan/request.rb', line 7 def initialize(notification) @path = "/3/device/#{notification.token}" @body = notification.body @headers = build_headers(notification) end |
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body.
5 6 7 |
# File 'lib/lorkhan/request.rb', line 5 def body @body end |
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
5 6 7 |
# File 'lib/lorkhan/request.rb', line 5 def headers @headers end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
5 6 7 |
# File 'lib/lorkhan/request.rb', line 5 def path @path end |
Instance Method Details
#validate! ⇒ Object
13 14 15 |
# File 'lib/lorkhan/request.rb', line 13 def validate! raise Errors::MissingTopicError if headers['apns-topic'].nil? end |