Class: JPush::ExistResult

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeExistResult

Returns a new instance of ExistResult.


8
9
10
# File 'lib/jpush/model/exist_result.rb', line 8

def initialize
  @isok=false
end

Instance Attribute Details

#isokObject

Returns the value of attribute isok


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

def isok
  @isok
end

#resultObject

Returns the value of attribute result


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

def result
  @result
end

Instance Method Details

#fromResponse(wrapper) ⇒ Object


11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/jpush/model/exist_result.rb', line 11

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
  hash = JSON.parse(content)
  @result = hash['result']
  @isok=true
  return self
end

#toJSONObject


26
27
28
29
30
# File 'lib/jpush/model/exist_result.rb', line 26

def toJSON
  array={}
  array['result'] = @result
  return array
end