Class: JPush::ResponseWrapper
- Inherits:
-
Object
- Object
- JPush::ResponseWrapper
- Defined in:
- lib/jpush/response_wrapper.rb
Instance Attribute Summary collapse
-
#code ⇒ Object
Returns the value of attribute code.
-
#error ⇒ Object
Returns the value of attribute error.
-
#rateLimitQuota ⇒ Object
Returns the value of attribute rateLimitQuota.
-
#rateLimitRemaining ⇒ Object
Returns the value of attribute rateLimitRemaining.
-
#rateLimitReset ⇒ Object
Returns the value of attribute rateLimitReset.
-
#responseContent ⇒ Object
Returns the value of attribute responseContent.
Instance Method Summary collapse
- #getResponseContent ⇒ Object
-
#initialize ⇒ ResponseWrapper
constructor
A new instance of ResponseWrapper.
- #setErrorObject ⇒ Object
- #setRateLimit(quota, remaining, reset) ⇒ Object
- #setResponseContent(content) ⇒ Object
Constructor Details
#initialize ⇒ ResponseWrapper
Returns a new instance of ResponseWrapper.
4 5 6 7 |
# File 'lib/jpush/response_wrapper.rb', line 4 def initialize() @logger = Logger.new(STDOUT) end |
Instance Attribute Details
#code ⇒ Object
Returns the value of attribute code.
3 4 5 |
# File 'lib/jpush/response_wrapper.rb', line 3 def code @code end |
#error ⇒ Object
Returns the value of attribute error.
3 4 5 |
# File 'lib/jpush/response_wrapper.rb', line 3 def error @error end |
#rateLimitQuota ⇒ Object
Returns the value of attribute rateLimitQuota.
3 4 5 |
# File 'lib/jpush/response_wrapper.rb', line 3 def rateLimitQuota @rateLimitQuota end |
#rateLimitRemaining ⇒ Object
Returns the value of attribute rateLimitRemaining.
3 4 5 |
# File 'lib/jpush/response_wrapper.rb', line 3 def rateLimitRemaining @rateLimitRemaining end |
#rateLimitReset ⇒ Object
Returns the value of attribute rateLimitReset.
3 4 5 |
# File 'lib/jpush/response_wrapper.rb', line 3 def rateLimitReset @rateLimitReset end |
#responseContent ⇒ Object
Returns the value of attribute responseContent.
3 4 5 |
# File 'lib/jpush/response_wrapper.rb', line 3 def responseContent @responseContent end |
Instance Method Details
#getResponseContent ⇒ Object
28 29 30 |
# File 'lib/jpush/response_wrapper.rb', line 28 def getResponseContent return @responseContent end |
#setErrorObject ⇒ Object
32 33 34 35 |
# File 'lib/jpush/response_wrapper.rb', line 32 def setErrorObject @error = JSON.parse @responseContent @error = @error['error'] end |
#setRateLimit(quota, remaining, reset) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/jpush/response_wrapper.rb', line 8 def setRateLimit(quota, remaining, reset) if quota.class != Fixnum raise ArgumentError.new('quota is not FIXnum') end if remaining.class != Fixnum raise ArgumentError.new('remaining is not FIXnum') end if reset.class != Fixnum raise ArgumentError.new('reset is not FIXnum') end @quota = quota @remaining = remaining @reset = reset @logger.debug("JPush API Rate Limiting params - quota:" + quota.to_s + ", remaining:" + remaining.to_s + ", reset:" + reset.to_s) end |
#setResponseContent(content) ⇒ Object
24 25 26 |
# File 'lib/jpush/response_wrapper.rb', line 24 def setResponseContent(content) @responseContent = content end |