Kong / unirest-ruby

Unirest in Ruby: Simplified, lightweight HTTP client library.
http://unirest.io/ruby
MIT License
364 stars 81 forks source link

Unirest.user_agent failing with undefined method `user_agent' for Unirest:Module #19

Open swolfekabaminc opened 9 years ago

swolfekabaminc commented 9 years ago

looks like the method has moved to the HttpClient class.

Documentation says it can be used as Unirest.user_agent('foobar') but I'm getting the error above.

spacewaffle commented 9 years ago

Can confirm, having the same issues.

mxlje commented 9 years ago

The method didn’t move (still defined on Unirest module).

I just tested this and can’t reproduce the error. Also the tests are passing and the Unirest.user_agent method is being tested.

Are you using the latest version (currently 1.1.2) ?

russiancatfood commented 9 years ago

Same problem here: NoMethodError: undefined method `user_agent' for Unirest:Module

Unirest.methods.sort gives (user_agent nowhere to be seen): => [:!, :!=, :!~, :<, :<=, :<=>, :==, :===, :=~, :>, :>=, :id, :send, :ancestors, :autoload, :autoload?, :class, :class_eval, :class_exec, :class_variable_defined?, :class_variable_get, :class_variable_set, :class_variables, :clear_default_headers, :clone, :const_defined?, :const_get, :const_missing, :const_set, :constants, :default_header, :define_singleton_method, :delete, :display, :dup, :enum_for, :eql?, :equal?, :extend, :freeze, :frozen?, :get, :hash, :include?, :included_modules, :inspect, :instance_eval, :instance_exec, :instance_method, :instance_methods, :instance_of?, :instance_variable_defined?, :instance_variable_get, :instance_variable_set, :instance_variables, :is_a?, :kind_of?, :method, :method_defined?, :methods, :module_eval, :module_exec, :name, :nil?, :object_id, :patch, :post, :private_class_method, :private_constant, :private_instance_methods, :private_method_defined?, :private_methods, :protected_instance_methods, :protected_method_defined?, :protected_methods, :public_class_method, :public_constant, :public_instance_method, :public_instance_methods, :public_method, :public_method_defined?, :public_methods, :public_send, :put, :remove_class_variable, :remove_instance_variable, :respond_to?, :send, :singleton_class, :singleton_methods, :taint, :tainted?, :tap, :timeout, :to_enum, :to_json, :to_s, :trust, :untaint, :untrust, :untrusted?]

gem install gives: Successfully installed unirest-1.1.2

Ruby version: ruby 2.0.0p598 (2014-11-13 revision 48408) [x86_64-darwin14.0.0]

st0ck commented 9 years ago

+1

mxlje commented 9 years ago

I think I found the problem. Looks like Unirest.user_agent is only implemented in the master branch here on GitHub but is not published to Rubygems.

@ahmadnassri can you please bump the version and publish that?

Thank you.

tit commented 8 years ago

+1

irb(main):003:0> require 'unirest'
irb(main):004:0> Unirest.user_agent
NoMethodError: undefined method `user_agent' for Unirest:Module
    from (irb):4
    from /usr/bin/irb:12:in `<main>'
bltb commented 8 years ago

+1

andrhamm commented 8 years ago

Can a new rubygems version be released please? It is not ideal to have github: 'Mashape/unirest-ruby' in my Gemfile.