Class: Chen::RemoteQuery

Inherits:
Object
  • Object
show all
Defined in:
lib/chen.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#default_hostObject

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