Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NoMethodError: undefined method `<=>' for :method:Symbol #44

Open
cbolanos79 opened this issue Feb 15, 2013 · 2 comments
Open

NoMethodError: undefined method `<=>' for :method:Symbol #44

cbolanos79 opened this issue Feb 15, 2013 · 2 comments

Comments

@cbolanos79
Copy link

Hello,

I got this error trying to upload a video:

NoMethodError: undefined method <=>' for :method:Symbol from /var/lib/gems/1.8/gems/oauth-0.4.7/lib/oauth/helper.rb:37:in<=>'
from /var/lib/gems/1.8/gems/oauth-0.4.7/lib/oauth/helper.rb:37:in sort' from /var/lib/gems/1.8/gems/oauth-0.4.7/lib/oauth/helper.rb:37:innormalize'
from /var/lib/gems/1.8/gems/oauth-0.4.7/lib/oauth/consumer.rb:362:in create_http_request' from /var/lib/gems/1.8/gems/oauth-0.4.7/lib/oauth/consumer.rb:187:increate_signed_request'
from /var/lib/gems/1.8/gems/oauth-0.4.7/lib/oauth/consumer.rb:159:in request' from /var/lib/gems/1.8/gems/vimeo/lib/vimeo/advanced/base.rb:104:inmake_request'
from (eval):13:in `get_quota'

Problem is located at lib/vimeo/advanced/base.rb:99

raw_response = @oauth_consumer.request(:post, Vimeo::Advanced::Base::ENDPOINT, get_access_token, {}, options).body

OAuth::Helper#normalize expects to receive options hash keys as string not symbols:

def normalize(params)
  params.sort.map do |k, values|

So I did this change on def make_request:

      options_strings = {}
      options_strings = options.map{|k,v| {k.to_s => v}}.reduce(:merge)

      #raw_response = @oauth_consumer.request("post", Vimeo::Advanced::Base::ENDPOINT, get_access_token, {}, options).body
      raw_response = @oauth_consumer.request("post", Vimeo::Advanced::Base::ENDPOINT, get_access_token, {}, options_strings).body

Tried again and worked right.
Hope this helps you.

@ciscou
Copy link

ciscou commented Mar 12, 2013

It works for ruby 1.9.3

I've implemented the following workaround for my ruby 1.8.7, rails 2.3.17, project:

# config/initializers/sortable_symbols

unless :dummy.respond_to? :<=>
  class Symbol
    def <=>(other)
      to_s <=> other.to_s
    end
  end
end

@cbolanos79
Copy link
Author

Thank you :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants