Module: Syoboemon::APIConnector
- Defined in:
- lib/syoboemon/api_connector.rb
Constant Summary collapse
- URL =
"http://cal.syoboi.jp"- RSS2_PATH =
"/rss2.php"- DB_PATH =
"/db.php"- JSON_PATH =
"/json.php"
Class Method Summary collapse
-
.get_db(query_params = {}) ⇒ Object
db.phpを利用するためのメソッド Example => APIConnector.db_get(“TitleLookup”, TID: 9029, Fields: “Comment,TID…”).
-
.get_json(query_params = {}) ⇒ Object
json.phpを利用するためのメソッド Example => APIConnector.json_get(“TitleSearch”, Title: “ご注文はうさぎですか?”, Limit: 15).
-
.get_rss2(query_params = {}) ⇒ Object
rss2.phpを利用するためのメソッド Example => APIConnector.rss2_get(“example_name”, filter: 0, count: 150, …).
Class Method Details
.get_db(query_params = {}) ⇒ Object
db.phpを利用するためのメソッドExample => APIConnector.db_get(“TitleLookup”, TID: 9029, Fields: “Comment,TID…”)
34 35 36 37 38 39 40 41 |
# File 'lib/syoboemon/api_connector.rb', line 34 def get_db(query_params={}) begin return connector.get(db_path, query_params).body rescue => e puts "#{e.message}" exit end end |
.get_json(query_params = {}) ⇒ Object
json.phpを利用するためのメソッドExample => APIConnector.json_get(“TitleSearch”, Title: “ご注文はうさぎですか?”, Limit: 15)
45 46 47 48 49 50 51 52 |
# File 'lib/syoboemon/api_connector.rb', line 45 def get_json(query_params={}) begin return connector.get(json_path, query_params).body rescue => e puts "#{e.message}" exit end end |
.get_rss2(query_params = {}) ⇒ Object
rss2.phpを利用するためのメソッドExample => APIConnector.rss2_get(“example_name”, filter: 0, count: 150, …)
23 24 25 26 27 28 29 30 |
# File 'lib/syoboemon/api_connector.rb', line 23 def get_rss2(query_params={}) begin return connector.get(rss2_path, query_params).body rescue => e puts "#{e.messege}" exit end end |