Sha256: d41ab37a03e6979ed3077b3453c9d87982476fe8c3a729880162e4d2e088a157
Contents?: true
Size: 1.02 KB
Versions: 1
Compression:
Stored size: 1.02 KB
Contents
module Pushover class Response include Creatable attribute name: 'user', kind_of: String attribute name: 'errors', kind_of: Array attribute name: 'status', kind_of: Numeric attribute name: 'receipt', kind_of: String attribute name: 'request', kind_of: String attribute name: 'original', kind_of: String attribute name: 'limit', kind_of: String attribute name: 'remaining', kind_of: String attribute name: 'reset', kind_of: String def initialize @status = 0 @errors = [] end def process process_body process_headers end def process_body body = Oj.load original[:body] @status = body["status"] @request = body["request"] @receipt = body["receipt"] if body["receipt"] @errors = body["errors"] if body["errors"] end def process_headers @limit = original.headers['X-Limit-App-Limit'] @remaining = original.headers['X-Limit-App-Remaining'] @reset = original.headers['X-Limit-App-Reset'] end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pushover-2.0.0 | lib/pushover/response.rb |