Ruby on Rails の PayPal REST API を試しています。Ruby のhttps://developer.paypal.com/webapps/developer/docs/api/の例「OAuth リクエスト/レスポンス」に従っています。
class PaymentsController < ApplicationController
include PayPal::SDK::REST
def pay
@api = PayPal::SDK::REST.set_config(
:ssl_options => {}, # Set ssl options
:mode => :sandbox, # Set :sandbox or :live
:client_id => "XXXXXXXXXXX",
:client_secret => "XXXXXXXXXXX" )
@api.token
end
end
理由はわかりませんが、次のエラーが表示されます。
LoadError in PaymentsController#pay
no such file to load -- {"scope":"openid https://api.paypal.com/v1/payments/.* https://api.paypal.com/v1/vault/credit-card/.* https://api.paypal.com/v1/vault/credit-card https://api.paypal.com/v1/developer/.*","access_token":"Mnlhn0RcJ9KWQTU6z5-cH5iDu8aeMzOM7TACw1NhFp0","token_type":"Bearer","app_id":"APP-80W284485P519543T","expires_in":28800}
full trace
activesupport (3.0.20) lib/active_support/dependencies.rb:236:in `load'
activesupport (3.0.20) lib/active_support/dependencies.rb:236:in `block in load'
activesupport (3.0.20) lib/active_support/dependencies.rb:225:in `block in load_dependency'
activesupport (3.0.20) lib/active_support/dependencies.rb:597:in `new_constants_in'
activesupport (3.0.20) lib/active_support/dependencies.rb:225:in `load_dependency'
activesupport (3.0.20) lib/active_support/dependencies.rb:236:in `load'
paypal-sdk-core (0.2.6) lib/paypal-sdk/core/api/rest.rb:58:in `token_hash'
paypal-sdk-core (0.2.6) lib/paypal-sdk/core/api/rest.rb:65:in `token'
app/controllers/payments_controller.rb:15:in `pay'
actionpack (3.0.20) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
actionpack (3.0.20) lib/abstract_controller/base.rb:150:in `process_action'
actionpack (3.0.20) lib/action_controller/metal/rendering.rb:11:in `process_action'
actionpack (3.0.20) lib/abstract_controller/callbacks.rb:18:in `block in process_action'
activesupport (3.0.20) lib/active_support/callbacks.rb:456:in `_run__1063560453__process_action__391973748__callbacks'
activesupport (3.0.20) lib/active_support/callbacks.rb:410:in `_run_process_action_callbacks'
activesupport (3.0.20) lib/active_support/callbacks.rb:94:in `run_callbacks'
actionpack (3.0.20) lib/abstract_controller/callbacks.rb:17:in `process_action'
actionpack (3.0.20) lib/action_controller/metal/rescue.rb:17:in `process_action'
actionpack (3.0.20) lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
activesupport (3.0.20) lib/active_support/notifications.rb:52:in `block in instrument'
activesupport (3.0.20) lib/active_support/notifications/instrumenter.rb:21:in `instrument'
activesupport (3.0.20) lib/active_support/notifications.rb:52:in `instrument'
actionpack (3.0.20) lib/action_controller/metal/instrumentation.rb:29:in `process_action'
newrelic_rpm (3.5.6.55) lib/new_relic/agent/instrumentation/rails3/action_controller.rb:34:in `block in process_action'
newrelic_rpm (3.5.6.55) lib/new_relic/agent/instrumentation/controller_instrumentation.rb:268:in `block in perform_action_with_newrelic_trace'
newrelic_rpm (3.5.6.55) lib/new_relic/agent/method_tracer.rb:240:in `trace_execution_scoped'
newrelic_rpm (3.5.6.55) lib/new_relic/agent/instrumentation/controller_instrumentation.rb:263:in `perform_action_with_newrelic_trace'
newrelic_rpm (3.5.6.55) lib/new_relic/agent/instrumentation/rails3/action_controller.rb:33:in `process_action'
actionpack (3.0.20) lib/abstract_controller/base.rb:119:in `process'
actionpack (3.0.20) lib/abstract_controller/rendering.rb:41:in `process'
actionpack (3.0.20) lib/action_controller/metal.rb:138:in `dispatch'
actionpack (3.0.20) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
actionpack (3.0.20) lib/action_controller/metal.rb:178:in `block in action'
actionpack (3.0.20) lib/action_dispatch/routing/route_set.rb:68:in `call'
actionpack (3.0.20) lib/action_dispatch/routing/route_set.rb:68:in `dispatch'
actionpack (3.0.20) lib/action_dispatch/routing/route_set.rb:33:in `call'
rack-mount (0.6.14) lib/rack/mount/route_set.rb:148:in `block in call'
rack-mount (0.6.14) lib/rack/mount/code_generation.rb:93:in `block in recognize'
rack-mount (0.6.14) lib/rack/mount/code_generation.rb:68:in `optimized_each'
rack-mount (0.6.14) lib/rack/mount/code_generation.rb:92:in `recognize'
rack-mount (0.6.14) lib/rack/mount/route_set.rb:139:in `call'
actionpack (3.0.20) lib/action_dispatch/routing/route_set.rb:499:in `call'
oink (0.9.3) lib/oink/middleware.rb:17:in `call'
newrelic_rpm (3.5.6.55) lib/new_relic/rack/error_collector.rb:8:in `call'
newrelic_rpm (3.5.6.55) lib/new_relic/rack/agent_hooks.rb:14:in `call'
newrelic_rpm (3.5.6.55) lib/new_relic/rack/browser_monitoring.rb:12:in `call'
newrelic_rpm (3.5.6.55) lib/new_relic/rack/developer_mode.rb:24:in `call'
warden (1.0.6) lib/warden/manager.rb:35:in `block in call'
warden (1.0.6) lib/warden/manager.rb:34:in `catch'
warden (1.0.6) lib/warden/manager.rb:34:in `call'
actionpack (3.0.20) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
actionpack (3.0.20) lib/action_dispatch/middleware/head.rb:14:in `call'
rack (1.2.7) lib/rack/methodoverride.rb:24:in `call'
actionpack (3.0.20) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
actionpack (3.0.20) lib/action_dispatch/middleware/flash.rb:182:in `call'
actionpack (3.0.20) lib/action_dispatch/middleware/session/abstract_store.rb:149:in `call'
actionpack (3.0.20) lib/action_dispatch/middleware/cookies.rb:302:in `call'
activerecord (3.0.20) lib/active_record/query_cache.rb:32:in `block in call'
activerecord (3.0.20) lib/active_record/connection_adapters/abstract/query_cache.rb:28:in `cache'
activerecord (3.0.20) lib/active_record/query_cache.rb:12:in `cache'
activerecord (3.0.20) lib/active_record/query_cache.rb:31:in `call'
activerecord (3.0.20) lib/active_record/connection_adapters/abstract/connection_pool.rb:354:in `call'
actionpack (3.0.20) lib/action_dispatch/middleware/callbacks.rb:46:in `block in call'
activesupport (3.0.20) lib/active_support/callbacks.rb:416:in `_run_call_callbacks'
actionpack (3.0.20) lib/action_dispatch/middleware/callbacks.rb:44:in `call'
rack (1.2.7) lib/rack/sendfile.rb:106:in `call'
actionpack (3.0.20) lib/action_dispatch/middleware/remote_ip.rb:48:in `call'
actionpack (3.0.20) lib/action_dispatch/middleware/show_exceptions.rb:47:in `call'
railties (3.0.20) lib/rails/rack/logger.rb:13:in `call'
rack (1.2.7) lib/rack/runtime.rb:17:in `call'
activesupport (3.0.20) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
rack (1.2.7) lib/rack/lock.rb:13:in `block in call'
<internal:prelude>:10:in `synchronize'
rack (1.2.7) lib/rack/lock.rb:13:in `call'
actionpack (3.0.20) lib/action_dispatch/middleware/static.rb:30:in `call'
airbrake (3.1.6) lib/airbrake/rack.rb:41:in `call'
airbrake (3.1.6) lib/airbrake/user_informer.rb:12:in `call'
railties (3.0.20) lib/rails/application.rb:168:in `call'
railties (3.0.20) lib/rails/application.rb:77:in `method_missing'
railties (3.0.20) lib/rails/rack/log_tailer.rb:14:in `call'
rack (1.2.7) lib/rack/content_length.rb:13:in `call'
rack (1.2.7) lib/rack/handler/webrick.rb:52:in `service'
/home/jorge/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/webrick/httpserver.rb:111:in `service'
/home/jorge/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/webrick/httpserver.rb:70:in `run'
/home/jorge/.rvm/rubies/ruby-1.9.2-p290/lib/ruby/1.9.1/webrick/server.rb:183:in `block in start_thread'
This error occurred while loading the following files:
{"scope":"openid https://api.paypal.com/v1/payments/.* https://api.paypal.com/v1/vault/credit-card/.* https://api.paypal.com/v1/vault/credit-card https://api.paypal.com/v1/developer/.*","access_token":"Mnlhn0RcJ9KWQTU6z5-cH5iDu8aeMzOM7TACw1NhFp0","token_type":"Bearer","app_id":"APP-80W284485P519543T","expires_in":28800}
解決済み: multi_json gem を最新バージョンに更新します。