1. <strong id="7actg"></strong>
    2. <table id="7actg"></table>

    3. <address id="7actg"></address>
      <address id="7actg"></address>
      1. <object id="7actg"><tt id="7actg"></tt></object>

        HTTPartyRuby的HTTP/REST客戶端庫

        聯(lián)合創(chuàng)作 · 2023-09-19 08:26

        HTTParty是目前最受Ruby愛好者歡迎的一個簡單的HTTP / REST客戶端庫。

        示例代碼:

         

        require 'rubygems'

        require 'httparty'

         

        class Representative

          include HTTParty

          base_uri 'whoismyrepresentative.com'

          default_params :output => 'json'

          format :json

         

          def self.find_by_zip(zip)

            get('/whoismyrep.php', :query => {:zip => zip})

          end

         

          def self.get_all_by_name(last_name)

            get('/getall_reps_byname.php', :query => {:lastname => last_name})

          end

        end

         

        puts Representative.get_all_by_name('Donnelly').inspect

        # {"results"=>[{"district"=>"2", "last"=>"Donnelly", "first"=>"Joe", "state"=>"IN", "party"=>"D"}]}

         

        瀏覽 20
        點贊
        評論
        收藏
        分享

        手機掃一掃分享

        編輯 分享
        舉報
        評論
        圖片
        表情
        推薦
        點贊
        評論
        收藏
        分享

        手機掃一掃分享

        編輯 分享
        舉報
        1. <strong id="7actg"></strong>
        2. <table id="7actg"></table>

        3. <address id="7actg"></address>
          <address id="7actg"></address>
          1. <object id="7actg"><tt id="7actg"></tt></object>
            97精品视频 | 国产精品宾馆在线 | 精品婷婷色一区二区三区蜜桃 | 国产高清视频在线观看 | 日本黄色录像 | 天天综合色 | 操逼网在线观看 | 操榴网 | 91国产精品一区 | 操女人逼逼视频 |