Class: Weibo::Api::V2::Base

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/weibo_focus/api/v2/base.rb

Constant Summary collapse

@@API_VERSION =
2

Instance Method Summary collapse

Constructor Details

#initialize(access_token) ⇒ Base

Returns a new instance of Base.



15
16
17
# File 'lib/weibo_focus/api/v2/base.rb', line 15

def initialize(access_token)
  @access_token = access_token
end

Instance Method Details

#hashie(response) ⇒ Object



19
20
21
22
23
24
25
26
# File 'lib/weibo_focus/api/v2/base.rb', line 19

def hashie(response)
  json_body = JSON.parse(response.body)
  if json_body.is_a? Array
    Array.new(json_body.count){|i| Hashie::Mash.new(json_body[i])}
  else
    Hashie::Mash.new json_body
  end
end