이 블로그의 지침에 따라 상당히 오래된 것으로 알고 있습니다. http://minimul.com/integrating-rails-and-quickbooks-online-via-the-version-3-api-part-1.htmlRuby on Rails와 Quickbooks의 통합이 작동하지 않습니다.
내 웹 응용 프로그램에서 'Quickbooks에 연결'버튼을 성공적으로 가져 왔지만 클릭하면 다음 오류가 발생합니다. 나는 Quickbooks에 선택을 취소 앞에있는 상자를 확인해야합니다 인튜이트 포럼에서 해답을 발견
token = $qb_oauth_consumer.get_request_token(:oauth_callback => callback)
:
NoMethodError in VendorsController#authenticate
undefined method `get_request_token' for nil:NilClass
오류의 소스는 내 업체 컨트롤러을 인증 행동이 선 것 같다 그것은 내 애플 리케이션 설정에서 지불. 나는 tht도했다. 이 경우 승인 페이지로 이동하지 않습니다.
는 /app/contollers/vendors.rb
는class VendorsController < ApplicationController
before_action :set_vendor, only: [:show, :edit, :update, :destroy]
# GET /vendors
# GET /vendors.json
def index
@vendors = Vendor.all
end
# GET /vendors/1
# GET /vendors/1.json
def show
end
# GET /vendors/new
def new
@vendor = Vendor.new
end
# GET /vendors/1/edit
def edit
end
# POST /vendors
# POST /vendors.json
def create
@vendor = Vendor.new(vendor_params)
respond_to do |format|
if @vendor.save
format.html { redirect_to @vendor, notice: 'Vendor was successfully created.' }
format.json { render action: 'show', status: :created, location: @vendor }
else
format.html { render action: 'new' }
format.json { render json: @vendor.errors, status: :unprocessable_entity }
end
end
end
# PATCH/PUT /vendors/1
# PATCH/PUT /vendors/1.json
def update
respond_to do |format|
if @vendor.update(vendor_params)
format.html { redirect_to @vendor, notice: 'Vendor was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render json: @vendor.errors, status: :unprocessable_entity }
end
end
end
# DELETE /vendors/1
# DELETE /vendors/1.json
def destroy
@vendor.destroy
respond_to do |format|
format.html { redirect_to vendors_url }
format.json { head :no_content }
end
end
def authenticate
callback = oauth_callback_vendors_url
*token = $qb_oauth_consumer.get_request_token(:oauth_callback => callback)*
session[:qb_request_token] = Marshal.dump(token)
redirect_to("https://appcenter.intuit.com/Connect/Begin?oauth_token=#{token.token}") and return
end
def oauth_callback
at = Marshal.load(session[:qb_request_token]).get_access_token(:oauth_verifier => params[:oauth_verifier])
session[:token] = at.token
session[:secret] = at.secret
session[:realm_id] = params['realmId']
redirect_to root_url, notice: "Your QuickBooks account has been successfully linked."
end
private
# Use callbacks to share common setup or constraints between actions.
def set_vendor
@vendor = Vendor.find(params[:id])
end
# Never trust parameters from the scary internet, only allow the white list through.
def vendor_params
params.require(:vendor).permit(:name)
end
end
보기 파일은 다음과 같다 :
<!--Quickbooks stuff-->
<!-- this will display a button that the user clicks to start the flow -->
<% unless session[:token] %>
<ipp:connectToIntuit></ipp:connectToIntuit>
<% end %>`
<script type="text/javascript" src="https://appcenter.intuit.com/Content/IA/intuit.ipp.anywhere.js"></script>
<!-- configure the Intuit object: 'grantUrl' is a URL in your application which kicks off the flow, see below -->
<script>
intuit.ipp.anywhere.setup({menuProxy: '/path/to/blue-dot', grantUrl: '<%= authenticate_vendors_url %>'});
</script>
</body>
는 config/이니셜/파일 quickbooks.rb
#Trying with custom code from "https://github.com/ruckus/quickbooks-ruby"
OAUTH_CONSUMER_KEY = "my app key"
OAUTH_CONSUMER_SECRET = "My APP Secret"
::QB_OAUTH_CONSUMER = OAuth::Consumer.new(OAUTH_CONSUMER_KEY, OAUTH_CONSUMER_SECRET, {
:site => "https://oauth.intuit.com",
:request_token_path => "/oauth/v1/get_request_token",
:authorize_url => "https://appcenter.intuit.com/Connect/Begin",
:access_token_path => "/oauth/v1/get_access_token"
})
다음은 내 gemfile입니다.
source 'https://rubygems.org'
gem 'nokogiri'
gem 'rack'
gem 'rails', '4.2.6'
#Action caching for Action Pack (removed from core in Rails 4.0).
gem 'actionpack-action_caching'
gem 'bootstrap-sass'
gem 'autoprefixer-rails'
gem 'bundler', '~>1.12.5'
# Use SCSS for stylesheets
gem 'sass-rails'
#charting rails
gem 'highcharts-rails'
gem 'quickbooks-ruby'
gem 'oauth-plugin'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.1.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'therubyracer', platforms: :ruby
# Use jquery as the JavaScript library
gem 'jquery-rails'
# Turbolinks makes following links in your web application faster. Read more: https://github.com/rails/turbolinks
gem 'turbolinks'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.0'
# bundle exec rake doc:rails generates the API under doc/api.
gem 'sdoc', '~> 0.4.0', group: :doc
gem 'heroku'
#Passwordless Authentication
gem 'omniauth', '~> 1.3.1'
gem 'omniauth-auth0', '~> 1.4.1'
#DynoPoker to ping dyno every 30 mins so that loading time is not slow....hopefully!
gem 'dynopoker'
gem 'stripe'
group :development do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
#gem 'byebug'
# Use sqlite3 as the database for Active Record
gem 'pg'
end
group :production do
gem 'rails_12factor'
gem 'therubyracer'
end
group :test do
gem 'rspec'
end
그리고 난 내가 뭘 잘못 루비 2.3.0
어떤 아이디어를 사용할 수 있습니까?
처음에는 약간의 코드를 게시하여 실제로 무슨 일을하는지 볼 수 있습니다. 설정이 완료되면 게시하십시오. –
u가 이걸 많이 들었을 것입니다 ... 그래서 저는 ROR에 익숙하지 않습니다. – neutralCreep