Class: Taobao::TOP::Service
- Inherits:
-
Object
- Object
- Taobao::TOP::Service
- Defined in:
- lib/taobao/top/service.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
- #get(method, *args) ⇒ Object
-
#initialize(*args) {|@options| ... } ⇒ Service
constructor
A new instance of Service.
- #post(method, *args) ⇒ Object
Constructor Details
#initialize(*args) {|@options| ... } ⇒ Service
Returns a new instance of Service.
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.) @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
#options ⇒ Object (readonly)
Returns the value of attribute options.
59 60 61 |
# File 'lib/taobao/top/service.rb', line 59 def @options end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
59 60 61 |
# File 'lib/taobao/top/service.rb', line 59 def params @params end |
#response ⇒ Object (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 |