Class: Lorkhan::Request

Inherits:
Object
  • Object
show all
Defined in:
lib/lorkhan/request.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#bodyObject (readonly)

Returns the value of attribute body.



5
6
7
# File 'lib/lorkhan/request.rb', line 5

def body
  @body
end

#headersObject (readonly)

Returns the value of attribute headers.



5
6
7
# File 'lib/lorkhan/request.rb', line 5

def headers
  @headers
end

#pathObject (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