Class: Baidu::Response
- Inherits:
-
Object
- Object
- Baidu::Response
- Defined in:
- lib/baidu/response.rb
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#desc ⇒ Object
Returns the value of attribute desc.
-
#header ⇒ Object
Returns the value of attribute header.
-
#oprs ⇒ Object
Returns the value of attribute oprs.
-
#oprtime ⇒ Object
Returns the value of attribute oprtime.
-
#quota ⇒ Object
Returns the value of attribute quota.
-
#rquota ⇒ Object
Returns the value of attribute rquota.
-
#status ⇒ Object
Returns the value of attribute status.
Instance Method Summary collapse
-
#initialize(response, name_response_sym) ⇒ Response
constructor
A new instance of Response.
Constructor Details
#initialize(response, name_response_sym) ⇒ Response
Returns a new instance of Response.
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/baidu/response.rb', line 4 def initialize(response,name_response_sym) name_response_sym = case name_response_sym when 'getAllCampaign' 'GetAllCampaign' when 'getCampaignByCampaignId' 'GetCampaignByCampaignId' when 'addCampaign' 'AddCampaign' when 'updateCampaign' 'UpdateCampaign' when 'deleteCampaign' 'DeleteCampaign' when 'getCampaignByCampaignId' 'GetCampaignByCampaignId' else name_response_sym end @header = response.header[:res_header] @body = response.body[name_response_sym] if(response.body and response.body.has_key?name_response_sym) @rquota = @header[:rquota].to_i @quota = @header[:quota].to_i @status = @header[:status].to_i @desc = @header[:desc] @oprs = @header[:oprs] @oprtime = @header[:oprtime] end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
3 4 5 |
# File 'lib/baidu/response.rb', line 3 def body @body end |
#desc ⇒ Object
Returns the value of attribute desc.
3 4 5 |
# File 'lib/baidu/response.rb', line 3 def desc @desc end |
#header ⇒ Object
Returns the value of attribute header.
3 4 5 |
# File 'lib/baidu/response.rb', line 3 def header @header end |
#oprs ⇒ Object
Returns the value of attribute oprs.
3 4 5 |
# File 'lib/baidu/response.rb', line 3 def oprs @oprs end |
#oprtime ⇒ Object
Returns the value of attribute oprtime.
3 4 5 |
# File 'lib/baidu/response.rb', line 3 def oprtime @oprtime end |
#quota ⇒ Object
Returns the value of attribute quota.
3 4 5 |
# File 'lib/baidu/response.rb', line 3 def quota @quota end |
#rquota ⇒ Object
Returns the value of attribute rquota.
3 4 5 |
# File 'lib/baidu/response.rb', line 3 def rquota @rquota end |
#status ⇒ Object
Returns the value of attribute status.
3 4 5 |
# File 'lib/baidu/response.rb', line 3 def status @status end |