mattgreen / elevate

Streamline your RubyMotion controllers
MIT License
126 stars 10 forks source link

Undefined method error #9

Closed citrus closed 11 years ago

citrus commented 11 years ago

I'm getting the following error when trying to use elevate:

2013-07-08 12:46:04.108 ExampleApp[29827:1b03] user.rb:12:in `block in authenticate!:': undefined method `post' for Elevate::HTTP:Class (NoMethodError)
    from operation.rb:50:in `main'

And the code:

def authenticate!(username, password)
  @authenticate_task = async username: username, password: password do
    task do
      response = Elevate::HTTP.post("http://example.com/api/sessions.json", username: @username, password: @password)
      puts "response: "
      puts response.inspect
    end
    on_start do
      puts "requesting.."
    end    
    on_finish do |result, exception|
      puts "complete.."
      puts result.inspect
    end
  end
end

What's really strange is rubymotion seems to be renaming classes inside the HTTP namespace... for example this fails:

(main)> Elevate::HTTP::Request::METHODS
2013-07-08 12:56:02.128 ExampleApp[30165:c07] uninitialized constant Elevate::HTTP::Request (NameError)
=> #<NameError: uninitialized constant Elevate::HTTP::Request>

But this works:

(main)> Elevate::HTTP::HTTPRequest::METHODS
=> [:get, :post, :put, :delete, :patch, :head, :options]

Any ideas?

Thanks!! :beer:

mattgreen commented 11 years ago

What version are you using? I have not actually pushed 0.6.0, though the docs are updated. I suspect you're using 0.5.x. You can pull from git in the meantime.

citrus commented 11 years ago

I'm using 0.5.0 with bundler and the latest release of rubymotion. I'll try using the repo instead, thanks.

mattgreen commented 11 years ago

Hope it fixes it for you. If not, chime in. :)

citrus commented 11 years ago

That worked :) Thanks again! :beers: