Sha256: a52f004b74126f5284b57f512bacf8e163f247ffd276367c39da3a4d87b31c9b
Contents?: true
Size: 1.08 KB
Versions: 3
Compression:
Stored size: 1.08 KB
Contents
# -*- coding: utf-8 -*- # must use oauth library. class OAuthRubytter < Rubytter # access_token: must be instance of OAuth::AccessToken def initialize(access_token, options = {}) super(nil, nil, options) @access_token = access_token end def get(path, params = {}) path += '.json' param_str = self.class.to_param_str(params) path = path + '?' + param_str unless param_str.empty? structize(@access_token.get(path, @header)) end def post(path, params = {}) path += '.json' structize(@access_token.post(path, params, @header)) end def put(path, params = {}) path += '.json' structize(@access_token.put(path, params, @header)) end def delete(path, params = {}) path += '.json' param_str = self.class.to_param_str(params) path = path + '?' + param_str unless param_str.empty? structize(@access_token.delete(path, @header)) end def structize(res) json_data = JSON.parse(res.body) case res.code when "200" self.class.structize(json_data) else raise APIError.new(json_data['error'], res) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rubytter-0.11.0 | lib/rubytter/oauth_rubytter.rb |
rubytter-0.10.3 | lib/rubytter/oauth_rubytter.rb |
rubytter-0.10.2 | lib/rubytter/oauth_rubytter.rb |