Module: Kuaidi100::Service

Defined in:
lib/kuaidi100/service.rb

Constant Summary collapse

KUAIDI100_URL =
'http://api.kuaidi100.com/api'

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.create_url(options = {}) ⇒ Object



7
8
9
10
# File 'lib/kuaidi100/service.rb', line 7

def self.create_url(options = {})
  options = { 'id' => Kuaidi100.key }.merge(Utils.stringify_keys(options))
  "#{ KUAIDI100_URL }?#{query_string(options)}"
end

.query_string(options) ⇒ Object



12
13
14
15
16
# File 'lib/kuaidi100/service.rb', line 12

def self.query_string(options)
  options.map do |key, value|
    "#{ CGI.escape(key.to_s) }=#{ CGI.escape(value.to_s) }"
  end.join('&')
end

Instance Method Details

#check_queryObject

TODO: check params



19
20
# File 'lib/kuaidi100/service.rb', line 19

def check_query
end