lib/swimmy/command/restaurant_information.rb
# show detail info about certain place
show detail info about certain place
show detail info about certain place
def show_place_detail(params, options = {})
        query_str = params[:text]
        query_str = query_str.match(/「(.*)」の情報/)
        query_str = query_str[1]
        res = get_place_info(query_str)
        place_info = JSON.load(res.body)
        if place_info["status"] != "OK"
          return {text: "結果が取得できませんでした"}.merge(options).to_json
        end
        photo_ref = get_photo_ref(place_info)
        res = get_place_id(place_info)
        res = get_place_detail(res)
        place_detail = JSON.load(res.body)
        res = extract_data_from_json(place_detail)
        photo = get_place_photo(photo_ref)
        p photo = photo.body 
        photo = extract_photo_url(photo)
        user_name = params[:user_name] ? "<@#{params[:user_name]}>" : ""
        res_text = "#{user_name} \n【 *#{res["name"]}* 】 #{res["open_status"]} \n*価格帯*:moneybag:: #{res["price_level"]}　*評価*:star:: #{res["rating"]}/5　*URL*:computer:: #{res["website"]} \n*レビュー*:information_desk_person:: \n#{res["latest_review"]} \n#{photo}"
        return {text: res_text}.merge(options).to_json
      end
def show_place_detail ( params , options = { } ) query_str = params [ :text ] query_str = query_str . match ( / 「(.*)」の情報/) query_str = query_str [ 1 ] res = get_place_info ( query_str ) place_info = JSON . load ( res . body ) if place_info [ "status" ] != "OK" return { text : "結果が取得できませんでした"}.merge(options).to_json end photo_ref = get_photo_ref ( place_info ) res = get_place_id ( place_info ) res = get_place_detail ( res ) place_detail = JSON . load ( res . body ) res = extract_data_from_json ( place_detail ) photo = get_place_photo ( photo_ref ) p photo = photo . body photo = extract_photo_url ( photo ) user_name = params [ :user_name ] ? "<@#{params[:user_name]}>" : "" res_text = "#{user_name} \n【 *#{res["name"]}* 】 #{res["open_status"]} \n*価格帯*:moneybag:: #{res["price_level"]}　*評価*:star:: #{res["rating"]}/5　*URL*:computer:: #{res["website"]} \n*レビュー*:information_desk_person:: \n#{res["latest_review"]} \n#{photo}" return { text : res_text } . merge ( options ) . to_json end
show detail info about certain place
show detail info about certain place
# html
params
<not_specific>
options
<not_specific>