Class: JPush::TagListResult

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeTagListResult

Returns a new instance of TagListResult.


7
8
9
# File 'lib/jpush/model/tag_list_result.rb', line 7

def initialize
  @isok=false
end

Instance Attribute Details

#isokObject

Returns the value of attribute isok


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

def isok
  @isok
end

#tagsObject

Returns the value of attribute tags


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

def tags
  @tags
end

Instance Method Details

#fromResponse(wrapper) ⇒ Object


10
11
12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/jpush/model/tag_list_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
  hash = JSON.parse(content)
  @tags = hash['tags']
  @isok=true
  return self
end

#toJSONObject


25
26
27
28
29
# File 'lib/jpush/model/tag_list_result.rb', line 25

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