Class: Chen::RemoteQuery
- Inherits:
-
Object
- Object
- Chen::RemoteQuery
- Defined in:
- lib/chen.rb
Instance Attribute Summary collapse
-
#default_host ⇒ Object
Returns the value of attribute default_host.
Instance Method Summary collapse
Instance Attribute Details
#default_host ⇒ Object
Returns the value of attribute default_host.
34 35 36 |
# File 'lib/chen.rb', line 34 def default_host @default_host end |
Instance Method Details
#query_with_params(host, keyword, page_number = 1, size = 8) ⇒ Object
44 45 46 47 48 49 |
# File 'lib/chen.rb', line 44 def query_with_params(host, keyword, page_number = 1, size = 8) if(default_host && host.empty?) host = default_host end return raw_query("#{host}/api/#{keyword}/#{page_number}/#{size}") end |
#raw_query(url) ⇒ Object
39 40 41 42 |
# File 'lib/chen.rb', line 39 def raw_query(url) content = open url return content.read end |