投稿

6月, 2017の投稿を表示しています

translator

イメージ
I'll introduce rapidapi to you First,let's use spellcheck api. This is request code with ruby. Thanks to rapidapi,I didn't programming beacuse rapidapi makes us some request codes. response = Unirest.get "https://montanaflynn-spellcheck.p.mashape.com/check/?text=This+sentnce+has+some+probblems.", headers:{ "X-Mashape-Key" => "k7Nu0z8XmsmshQuVytz2jTawZyYBp1SNCfdjsnkXPqO1iR7zOi", "X-Mashape-Host" => "montanaflynn-spellcheck.p.mashape.com" } Then Response Very Convenient! Not only makes us some request codes, rapidapi makes us request code, but also we can make request code in similar notation by rapidapi gem. So, we don't have to study how to request to some apis which you wanna use. Second I'll use the rapidapi gem which I told you the very convenient thing. I'll give azure computer vision a picture of Michael Jackson Of course,you know he was one of the human,wan't
Pay.jpで定期課金実装 WebPayが提供終了らしいですね残念です。 stripe、webpayの同様の記事は何個かあるにもかかわらずpay.jpは皆無!? でも手数料はvisa3.0%(2.59%のプランもあり詳しくは 料金体系 )と激安。導入せずにはいられない! 環境 Ruby on Rails 4 Ruby 2.4 deviseなどでユーザ登録を実装済み 注意 私は綺麗なコードはかけません. あくまで参考程度にしてください. 実装 まず、 pay.jp で登録しましょう。 仕組み的には、 顧客(idを持っていて、カードをもたせて、顧客idを利用して決済につけるようにしたりする)&プラン(値段月払などをまとめて設定したもの)を作成->subscription関数に顧客&プランを渡す->完成 という流れです。 まず,userモデルにcustomer_idというカラムを追加します。(String型でお願いします.これを用いて、ユーザーに顧客idを紐つけます。 )その次に、pay.jpの管理画面でplanを作成してください。 //user.rb class User < ActiveRecord::Base def making_customer(email) if customer_id==nil Payjp.api_key = '入力してください' customer=Payjp::Customer.create( email:email, description: 'test', :card=>{ :number=>'4242424242424242', :cvc => '123', :exp_month => '2', :exp_year => '2020' } ) update(customer_id:customer.id) else