Mangopay / mangopay2-ruby-sdk

Ruby Gem for MANGOPAY
https://rubygems.org/gems/mangopay
MIT License
42 stars 38 forks source link

Log file is not a valid option #57

Closed ibelmonte closed 8 years ago

ibelmonte commented 8 years ago

Hello sirs and thank you in advance for your time and help. When I start the rails server I'm getting the next error message:

/Users/myuser/repos/myproject/web/config/initializers/mangopay.rb:7:in `block in <top (required)>': undefined method `log_file=' for #<MangoPay::Configuration:0x007fd88ab3db10> (NoMethodError)
    from /Users/myuser/.rvm/gems/ruby-2.2.1@myproject/gems/mangopay-3.0.23/lib/mangopay.rb:68:in `configure'
    from /Users/myuser/repos/myproject/web/config/initializers/mangopay.rb:3:in `<top (required)>'
    from /Users/myuser/.rvm/gems/ruby-2.2.1@myproject/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:268:in `load'
    from /Users/myuser/.rvm/gems/ruby-2.2.1@myproject/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:268:in `block in load'
    from /Users/myuser/.rvm/gems/ruby-2.2.1@myproject/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:240:in `load_dependency'
    from /Users/myuser/.rvm/gems/ruby-2.2.1@myproject/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:268:in `load'
    from /Users/myuser/.rvm/gems/ruby-2.2.1@myproject/gems/railties-4.2.4/lib/rails/engine.rb:652:in `block in load_config_initializer'
    from /Users/myuser/.rvm/gems/ruby-2.2.1@myproject/gems/activesupport-4.2.4/lib/active_support/notifications.rb:166:in `instrument'
    from /Users/myuser/.rvm/gems/ruby-2.2.1@myproject/gems/railties-4.2.4/lib/rails/engine.rb:651:in `load_config_initializer'
    from /Users/myuser/.rvm/gems/ruby-2.2.1@myproject/gems/railties-4.2.4/lib/rails/engine.rb:616:in `block (2 levels) in <class:Engine>'
    from /Users/myuser/.rvm/gems/ruby-2.2.1@myproject/gems/railties-4.2.4/lib/rails/engine.rb:615:in `each'
    from /Users/myuser/.rvm/gems/ruby-2.2.1@myproject/gems/railties-4.2.4/lib/rails/engine.rb:615:in `block in <class:Engine>'
    from /Users/myuser/.rvm/gems/ruby-2.2.1@myproject/gems/railties-4.2.4/lib/rails/initializable.rb:30:in `instance_exec'
    from /Users/myuser/.rvm/gems/ruby-2.2.1@myproject/gems/railties-4.2.4/lib/rails/initializable.rb:30:in `run'
    from /Users/myuser/.rvm/gems/ruby-2.2.1@myproject/gems/railties-4.2.4/lib/rails/initializable.rb:55:in `block in run_initializers'
    from /Users/myuser/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:226:in `block in tsort_each'
    from /Users/myuser/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:348:in `block (2 levels) in each_strongly_connected_component'
    from /Users/myuser/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:420:in `block (2 levels) in each_strongly_connected_component_from'
    from /Users/myuser/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:429:in `each_strongly_connected_component_from'
    from /Users/myuser/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:419:in `block in each_strongly_connected_component_from'
    from /Users/myuser/.rvm/gems/ruby-2.2.1@myproject/gems/railties-4.2.4/lib/rails/initializable.rb:44:in `each'
    from /Users/myuser/.rvm/gems/ruby-2.2.1@myproject/gems/railties-4.2.4/lib/rails/initializable.rb:44:in `tsort_each_child'
    from /Users/myuser/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:413:in `call'
    from /Users/myuser/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:413:in `each_strongly_connected_component_from'
    from /Users/myuser/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:347:in `block in each_strongly_connected_component'
    from /Users/myuser/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:345:in `each'
    from /Users/myuser/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:345:in `call'
    from /Users/myuser/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:345:in `each_strongly_connected_component'
    from /Users/myuser/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:224:in `tsort_each'
    from /Users/myuser/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/tsort.rb:203:in `tsort_each'
    from /Users/myuser/.rvm/gems/ruby-2.2.1@myproject/gems/railties-4.2.4/lib/rails/initializable.rb:54:in `run_initializers'
    from /Users/myuser/.rvm/gems/ruby-2.2.1@myproject/gems/railties-4.2.4/lib/rails/application.rb:352:in `initialize!'
    from /Users/myuser/repos/myproject/web/config/environment.rb:5:in `<top (required)>'
    from /Users/myuser/.rvm/gems/ruby-2.2.1@myproject/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:274:in `require'
    from /Users/myuser/.rvm/gems/ruby-2.2.1@myproject/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:274:in `block in require'
    from /Users/myuser/.rvm/gems/ruby-2.2.1@myproject/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:240:in `load_dependency'
    from /Users/myuser/.rvm/gems/ruby-2.2.1@myproject/gems/activesupport-4.2.4/lib/active_support/dependencies.rb:274:in `require'
    from /Users/myuser/.rvm/gems/ruby-2.2.1@myproject/gems/spring-1.4.3/lib/spring/application.rb:92:in `preload'
    from /Users/myuser/.rvm/gems/ruby-2.2.1@myproject/gems/spring-1.4.3/lib/spring/application.rb:143:in `serve'
    from /Users/myuser/.rvm/gems/ruby-2.2.1@myproject/gems/spring-1.4.3/lib/spring/application.rb:131:in `block in run'
    from /Users/myuser/.rvm/gems/ruby-2.2.1@myproject/gems/spring-1.4.3/lib/spring/application.rb:125:in `loop'
    from /Users/myuser/.rvm/gems/ruby-2.2.1@myproject/gems/spring-1.4.3/lib/spring/application.rb:125:in `run'
    from /Users/myuser/.rvm/gems/ruby-2.2.1@myproject/gems/spring-1.4.3/lib/spring/application/boot.rb:18:in `<top (required)>'
    from /Users/myuser/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /Users/myuser/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from -e:1:in `<main>'

Here is my initializer:

MANGOPAY_CONFIG = YAML.load_file("#{::Rails.root}/config/mangopay.yml")[::Rails.env]

MangoPay.configure do |c|
  c.preproduction = true
  c.client_id = MANGOPAY_CONFIG['client_id']
  c.client_passphrase = MANGOPAY_CONFIG['client_passphrase']
  c.log_file = "#{::Rails.root}/log/mangopay.log"
end

Am I doing anything wrong? Thank you!

javiercr commented 8 years ago

@ibelmonte it seems you're using the latest version of the gem available in RubyGems (3.0.23) released on August 31st, however that version does not include the log_file option, which was included in the #50 PR on September 2nd.

In other words, if you wanna use the log you need to use the master version from Github until Mangopay guys release a new version to RubyGems.

gem 'mangopay', github: 'Mangopay/mangopay2-ruby-sdk'
hobailey commented 8 years ago

Thanks @javiercr. We've just updated the RubyGems with the latest version :-)