Module: Qiniu::ADT::Policy
- Included in:
- Fop::Persistance::PfopPolicy, Storage::ListPolicy
- Defined in:
- lib/qiniu/adt.rb
Overview
class ApiSpecification
Instance Method Summary collapse
Instance Method Details
#to_json ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/qiniu/adt.rb', line 16 def to_json args = {} self.params.each_pair do |key, fld| val = self.__send__(key) if !val.nil? then args[fld] = val end end return args.to_json end |
#to_query_string ⇒ Object
to_json
29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/qiniu/adt.rb', line 29 def to_query_string args = [] self.params.each_pair do |key, fld| val = self.__send__(key) if !val.nil? then new_fld = CGI.escape(fld.to_s) new_val = CGI.escape(val.to_s).gsub('+', '%20') args.push("#{new_fld}=#{new_val}") end end return args.join("&") end |