Module: Express::Search

Includes:
Company
Defined in:
lib/express/search.rb,
lib/express/search/result.rb,
lib/express/search/company.rb,
lib/express/search/version.rb

Defined Under Namespace

Modules: Company Classes: Result

Constant Summary collapse

VERSION =
"0.1.3"

Constants included from Company

Company::MATCHES

Class Attribute Summary collapse

Class Method Summary collapse

Methods included from Company

included

Class Attribute Details

.idObject

Returns the value of attribute id.



14
15
16
# File 'lib/express/search.rb', line 14

def id
  @id
end

.secretObject

Returns the value of attribute secret.



14
15
16
# File 'lib/express/search.rb', line 14

def secret
  @secret
end

Class Method Details

.get_result(nu, com, type = "json", encode = "utf8", ord = "asc") ⇒ Object



17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/express/search.rb', line 17

def self.get_result(nu, com, type = "json", encode = "utf8", ord = "asc")
  uri = URI('http://api.ickd.cn')
  uri.query = URI.encode_www_form({
    id: id,
    secret: secret,
    nu: nu,
    com: company_code(com),
    type: type,
    encode: encode,
    ord: ord
  })

  Express::Search::Result.new JSON.parse(Net::HTTP.get_response(uri).body)
end