Class: JPush::ResponseWrapper

Inherits:
Object
  • Object
show all
Defined in:
lib/jpush/response_wrapper.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeResponseWrapper

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

#codeObject

Returns the value of attribute code


3
4
5
# File 'lib/jpush/response_wrapper.rb', line 3

def code
  @code
end

#errorObject

Returns the value of attribute error


3
4
5
# File 'lib/jpush/response_wrapper.rb', line 3

def error
  @error
end

#rateLimitQuotaObject

Returns the value of attribute rateLimitQuota


3
4
5
# File 'lib/jpush/response_wrapper.rb', line 3

def rateLimitQuota
  @rateLimitQuota
end

#rateLimitRemainingObject

Returns the value of attribute rateLimitRemaining


3
4
5
# File 'lib/jpush/response_wrapper.rb', line 3

def rateLimitRemaining
  @rateLimitRemaining
end

#rateLimitResetObject

Returns the value of attribute rateLimitReset


3
4
5
# File 'lib/jpush/response_wrapper.rb', line 3

def rateLimitReset
  @rateLimitReset
end

#responseContentObject

Returns the value of attribute responseContent


3
4
5
# File 'lib/jpush/response_wrapper.rb', line 3

def responseContent
  @responseContent
end

Instance Method Details

#getResponseContentObject


28
29
30
# File 'lib/jpush/response_wrapper.rb', line 28

def getResponseContent
  return @responseContent
end

#setErrorObjectObject


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