Class: Socketlab::AccountData
- Inherits:
-
SocketlabRequest
- Object
- SocketlabRequest
- Socketlab::AccountData
- Defined in:
- lib/socketlab/account_data.rb
Instance Attribute Summary collapse
-
#timestamp ⇒ Object
Returns the value of attribute timestamp.
Attributes inherited from SocketlabRequest
#api_password, #api_response, #api_server, #api_user, #api_version, #count, #error, #items, #query_params, #total_count, #total_pages
Instance Method Summary collapse
-
#api_request(query = {:type=>"JSON"}) ⇒ Object
JSON, JSONP, XML or CSV query :serverId=>“”,:type=>“JSON”.
-
#set_response ⇒ Object
Assuming type is json Setting Instance variable Dynamicaly and adding attr_accessor :server_id, :account_id, :plan_billing_period_start,:plan_billing_period_end,:billing_period_start,:billing_period_end, :billing_period_message_count,:billing_period_bandwidth_count_in_bytes,:billing_period_bandwidth_count_in_gigabytes, :billing_period_api_count,:api_allowance,:max_api_allowance,:message_allowance,:max_message_allowance, :bandwidth_allowance_in_bytes,:max_bandwidth_allowance_in_bytes,:bandwidth_allowance_in_gigabytes, :max_bandwidth_allowance_in_gigabytes,:is_over_api_allowance,:is_over_bandwidth_allowance,:is_over_message_allowance.
Methods inherited from SocketlabRequest
#initialize, #set_query_params_type, #set_request_options, #socketlab_request, #success?
Constructor Details
This class inherits a constructor from Socketlab::SocketlabRequest
Instance Attribute Details
#timestamp ⇒ Object
Returns the value of attribute timestamp.
4 5 6 |
# File 'lib/socketlab/account_data.rb', line 4 def end |
Instance Method Details
#api_request(query = {:type=>"JSON"}) ⇒ Object
JSON, JSONP, XML or CSV query :serverId=>“”,:type=>“JSON”
8 9 10 11 12 |
# File 'lib/socketlab/account_data.rb', line 8 def api_request(query={:type=>"JSON"}) @query_params =query socketlab_request("accountData") end |
#set_response ⇒ Object
Assuming type is json
Setting Instance variable Dynamicaly and adding attr_accessor
:server_id, :account_id, :plan_billing_period_start,:plan_billing_period_end,:billing_period_start,:billing_period_end,
:billing_period_message_count,:billing_period_bandwidth_count_in_bytes,:billing_period_bandwidth_count_in_gigabytes, :billing_period_api_count,:api_allowance,:max_api_allowance,:message_allowance,:max_message_allowance, :bandwidth_allowance_in_bytes,:max_bandwidth_allowance_in_bytes,:bandwidth_allowance_in_gigabytes, :max_bandwidth_allowance_in_gigabytes,:is_over_api_allowance,:is_over_bandwidth_allowance,:is_over_message_allowance
22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/socketlab/account_data.rb', line 22 def set_response if @api_response.success? = @api_response["timestamp"] unless @api_response["object"].nil? @api_response["object"].each do |attr_key,attr_val| self.class.send :attr_accessor ,attr_key.snake_case.to_sym self.instance_variable_set("@#{attr_key.snake_case}".to_sym,attr_val) end end else @error = @api_response.parsed_response end end |