Class: Taobao::TOP::Service

Inherits:
Object
  • Object
show all
Defined in:
lib/taobao/top/service.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) {|@options| ... } ⇒ Service

Returns a new instance of Service.

Yields:



61
62
63
64
65
66
# File 'lib/taobao/top/service.rb', line 61

def initialize *args, &block
  @options = TOP::Options.default.dup.merge(args.extract_options!)
  @app_key, @app_secret = args.slice!(0,2)
  raise ArgumentError.new "app_key or app_secret missing!" unless @app_key && @app_secret
  yield @options if block_given?
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



59
60
61
# File 'lib/taobao/top/service.rb', line 59

def options
  @options
end

#paramsObject (readonly)

Returns the value of attribute params.



59
60
61
# File 'lib/taobao/top/service.rb', line 59

def params
  @params
end

#responseObject (readonly)

Returns the value of attribute response.



59
60
61
# File 'lib/taobao/top/service.rb', line 59

def response
  @response
end

Instance Method Details

#get(method, *args) ⇒ Object



68
69
70
# File 'lib/taobao/top/service.rb', line 68

def get method, *args
  invoke method, :get, *args
end

#post(method, *args) ⇒ Object



72
73
74
# File 'lib/taobao/top/service.rb', line 72

def post method, *args
  invoke method, :post, *args
end