We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Hello, all.
Please help me. I use Garb::Management::Profile.all.detect and error happend to below:
MultiJson::AdapterError (Did not recognize your adapter specification (193: %1 は有効な Win32 アプリケーションではありません。 - C:/Ruby200/lib/ruby/gems/2.0.0/gems/json-1.8.1/lib/json/ext/parser.so).): app/services/analytics_service.rb:26:in load_profile' app/controllers/users_controller.rb:13:inshow'
load_profile' app/controllers/users_controller.rb:13:in
my environment is: OS: windows 7 home premium 64bit Ruby 2.0.0 64bit
load profile is defined below source:
require 'rubygems' require 'garb' require 'uri' require 'active_support/time' require 'yaml' class AnalyticsService def self.load_profile #設定読み込み f = File.open(File.join(Rails.root, 'app','services','conf.yml')) conf_str = f.read myconf = YAML.load(conf_str) #先月の初め # start_date = (1.month.ago Time.now).beginning_of_month #先月の終わり # end_date = (1.month.ago Time.now).end_of_month # セッションログイン Garb::Session.login( myconf['ga']['google_id'], myconf['ga']['google_pw'] ) # プロファイル情報の取得 profile = Garb::Management::Profile.all.detect { |p| p.web_property_id == myconf['ga']['property_id'] p.id == myconf['ga']['profile_id'] } end # 指標とディメンションをGarb::Modelをextendしたクラスに定義 # class PageTitle # extend Garb::Model # metrics :pageviews # dimensions :date # end # cond = { # :start_date => start_date, # :end_date => end_date, # # :filters => { :page_path.contains => '^/items/' } # } # rs = PageTitle.results(profile, cond) # p rs # rs.each do |r| # puts r.pageviews # ページビュー # end end
called load_profile method below source(controller)
class UsersController < ApplicationController before_action :signed_in_user, only: [:index, :edit, :update, :destroy] before_action :correct_user, only: [:edit, :update] before_action :admin_user, only: :destroy def index @users = User.paginate(page: params[:page]) end def show @user = User.find(params[:id]) ga_profile = AnalyticsService.load_profile cond = { :start_date => '2012-12-05', :end_date => '2013-01-05', # :filters => { :page_path.contains => '^/items/' } } @data = AnalyticsServiceClass::PageTitle.results(ga_profile, cond) end def new @user = User.new end def create @user = User.new(user_params) if @user.save sign_in @user flash[:success] = "Welcome to the Sample App!" redirect_to @user else render 'new' end end def edit end def update if @user.update_attributes(user_params) flash[:success] = "Profile updated" redirect_to @user else render 'edit' end end def destroy User.find(params[:id]).destroy flash[:success] = "User destroyed." redirect_to users_url end private def user_params params.require(:user).permit(:name, :email, :password, :password_confirmation) end # Before actions def signed_in_user unless signed_in? store_location redirect_to signin_url, notice: "Please sign in." end end def correct_user @user = User.find(params[:id]) redirect_to(root_path) unless current_user?(@user) end def admin_user redirect_to(root_path) unless current_user.admin? end end
gemfile is below:
source 'https://rubygems.org' ruby '2.0.0' #ruby-gemset=railstutorial_rails_4_0 gem 'rails', '4.0.5' gem 'pg', '0.15.1' gem 'bootstrap-sass', '2.3.2.0' gem 'sprockets', '2.11.0' gem 'bcrypt-ruby', '3.1.2' gem 'faker', '1.1.2' gem 'will_paginate', '3.0.4' gem 'bootstrap-will_paginate', '0.0.9' gem 'garb' group :development, :test do gem 'rspec-rails', '2.13.1' gem 'guard-rspec', '2.5.0' gem 'spork-rails', '4.0.0' gem 'guard-spork', '1.5.0' gem 'childprocess', '0.3.6' end group :test do gem 'selenium-webdriver', '2.35.1' gem 'capybara', '2.1.0' gem 'factory_girl_rails', '4.2.1' end gem 'sass-rails', '4.0.2' gem 'uglifier', '2.1.1' gem 'coffee-rails', '4.0.1' gem 'jquery-rails', '3.0.4' gem 'turbolinks', '1.1.1' gem 'jbuilder', '1.0.2' group :doc do gem 'sdoc', '0.3.20', require: false end group :production do gem 'rails_12factor', '0.0.2' end
The text was updated successfully, but these errors were encountered:
Try adding gem 'json' to your Gemfile
gem 'json'
Gemfile
Sorry, something went wrong.
No branches or pull requests
Hello, all.
Please help me.
I use Garb::Management::Profile.all.detect and error happend to below:
MultiJson::AdapterError (Did not recognize your adapter specification (193: %1 は有効な Win32 アプリケーションではありません。 - C:/Ruby200/lib/ruby/gems/2.0.0/gems/json-1.8.1/lib/json/ext/parser.so).):
app/services/analytics_service.rb:26:in
load_profile' app/controllers/users_controller.rb:13:in
show'my environment is:
OS: windows 7 home premium 64bit
Ruby 2.0.0 64bit
load profile is defined below source:
called load_profile method below source(controller)
gemfile is below:
The text was updated successfully, but these errors were encountered: