Class: JPush::GetMessagesResult

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeGetMessagesResult


6
7
8
# File 'lib/jpush/model/get_messages_result.rb', line 6

def initialize
  @isok = false
end

Instance Attribute Details

#isokObject

Returns the value of attribute isok


5
6
7
# File 'lib/jpush/model/get_messages_result.rb', line 5

def isok
  @isok
end

#resultObject

Returns the value of attribute result


5
6
7
# File 'lib/jpush/model/get_messages_result.rb', line 5

def result
  @result
end

Instance Method Details

#fromResponse(wrapper) ⇒ Object


10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/jpush/model/get_messages_result.rb', line 10

def fromResponse(wrapper)
  if wrapper.code != 200
    logger = Logger.new(STDOUT)
    logger.error('Error response from JPush server. Should review and fix it. ')
    logger.info('HTTP Status:' + wrapper.code.to_s)
    logger.info('Error Message' + wrapper.error.to_s)
    raise JPush::ApiConnectionException.new(wrapper)
  end
  content = wrapper.getResponseContent
  @result = JSON.parse(content)
  return self
end

#toJSONObject


23
24
25
# File 'lib/jpush/model/get_messages_result.rb', line 23

def toJSON
  return @result.to_json
end