Class: Zhuna::Hotel
- Inherits:
-
Object
- Object
- Zhuna::Hotel
- Defined in:
- lib/zhuna.rb
Instance Attribute Summary collapse
-
#params ⇒ Object
readonly
请求参数.
-
#result ⇒ Object
readonly
返回数据.
-
#url ⇒ Object
readonly
请求路径.
Instance Method Summary collapse
-
#hotel_pic(hid) ⇒ Object
酒店图片.
-
#initialize(agent_id, agent_md) ⇒ Hotel
constructor
A new instance of Hotel.
-
#room_price(hid, tm1, tm2) ⇒ Object
房型报价.
Constructor Details
#initialize(agent_id, agent_md) ⇒ Hotel
Returns a new instance of Hotel.
9 10 11 12 |
# File 'lib/zhuna.rb', line 9 def initialize(agent_id, agent_md) @agent_id = agent_id @agent_md = agent_md end |
Instance Attribute Details
#params ⇒ Object (readonly)
请求参数
6 7 8 |
# File 'lib/zhuna.rb', line 6 def params @params end |
#result ⇒ Object (readonly)
返回数据
7 8 9 |
# File 'lib/zhuna.rb', line 7 def result @result end |
#url ⇒ Object (readonly)
请求路径
5 6 7 |
# File 'lib/zhuna.rb', line 5 def url @url end |
Instance Method Details
#hotel_pic(hid) ⇒ Object
酒店图片
- hid
-
酒店ID
18 19 20 |
# File 'lib/zhuna.rb', line 18 def hotel_pic(hid) request("http://open.zhuna.cn/api/gateway.php?method=hotel.pic&hid=#{hid}&agent_id=#{@agent_id}&agent_md=#{@agent_md}") end |
#room_price(hid, tm1, tm2) ⇒ Object
房型报价
- hid
-
酒店ID
- tm1
-
入住日期
- tm2
-
离店日期
30 31 32 |
# File 'lib/zhuna.rb', line 30 def room_price(hid, tm1, tm2) request("http://www.api.zhuna.cn/e/json.php?hid=#{hid}&tm1=#{tm1}&tm2=#{tm2}") end |