mastodon/mastodon-api

Can't get id from Mastodon::Media?

ryanfb opened this issue · 4 comments

With the following code:

media = mastodon_client.upload_media(File.open(screenshot,'rb'))
puts media.id

The media seems to upload successfully, but I can't retrieve the id - the call to media.id results in the following error:

NoMethodError: undefined method `[]' for nil:NilClass
/Users/ryan/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0/bundler/gems/mastodon-api-a04f8aaa4425/lib/mastodon/base.rb:45:in `block in define_attribute_method'

(Using the git version of mastodon-api in my Gemfile due to #1)

Still broken for me, too.

still broken on main branch (eg. gem version). any idea if there's a fork with a fix?

well, main branch (1.2.0) is not the gem version (1.1.0), as far as I can tell. I was able to post media properly by using the local gem taken from cloning the repo.

sorry for being noisy, but just to resolve the issue, here's the gem line in my Gemfile:

gem 'mastodon-api', :github => 'tootsuite/mastodon-api'

works fine now.