Skip to content

Commit

Permalink
Fixed friendship_exists? which was throwing mash error. Now returns o…
Browse files Browse the repository at this point in the history
…bject if object is not mashable.
  • Loading branch information
jnunemaker committed Apr 5, 2009
1 parent b3b1481 commit 1e9def6
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
1 change: 1 addition & 0 deletions History
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
0.5.1 - April 5, 2009
* 1 minor change
* Added data error hash returned from twitter to a few of the exceptions to help with debugging
* Fixed friendship_exists?. Was throwing mash stringify keys error because it was returning true or false instead of hash or array.

0.5.0 - April 3, 2009
* 1 major rewrite for OAuth
Expand Down
13 changes: 13 additions & 0 deletions examples/friendship_existance.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
require File.join(File.dirname(__FILE__), '..', 'lib', 'twitter')
require File.join(File.dirname(__FILE__), 'helpers', 'config_store')
require 'pp'

config = ConfigStore.new("#{ENV['HOME']}/.twitter")

oauth = Twitter::OAuth.new(config['token'], config['secret'])
oauth.authorize_from_access(config['atoken'], config['asecret'])

client = Twitter::Base.new(oauth)

puts client.friendship_exists?('jnunemaker', 'orderedlist')
puts client.friendship_exists?('jnunemaker', 'biz')
4 changes: 3 additions & 1 deletion lib/twitter/request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,10 @@ def parse(response)
def mash(obj)
if obj.is_a?(Array)
obj.map { |item| Mash.new(item) }
else
elsif obj.is_a?(Hash)
Mash.new(obj)
else
obj
end
end

Expand Down

0 comments on commit 1e9def6

Please sign in to comment.