Class: BeaApi::Request
- Inherits:
-
Object
- Object
- BeaApi::Request
- Defined in:
- lib/bea_api/request.rb
Overview
> BeaApi::Request
Constant Summary collapse
- Success =
Sucess, no errors
0- InvalidKey =
APIErrorCode 3: The BEA API UserID provided in the request does not exist.
3- MissingParams =
APIErrorCode 40: The dataset requested requires parameters that were missing from the request
40- RetrivalError =
APIErrorCode 201: Error retrieving NIPA/Fixed Assets data
201- GDPRetrivalError =
APIErrorCode 204: Error retrieving GDP by Industry data
204- BEA_URL =
'http://www.bea.gov/api/data'
Instance Attribute Summary collapse
-
#error_code ⇒ Object
Returns the value of attribute error_code.
-
#error_msg ⇒ Object
Returns the value of attribute error_msg.
-
#notes ⇒ Object
Returns the value of attribute notes.
-
#response ⇒ Object
Returns the value of attribute response.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(uri) ⇒ Request
constructor
A new instance of Request.
Constructor Details
#initialize(uri) ⇒ Request
Returns a new instance of Request.
21 22 23 24 25 26 |
# File 'lib/bea_api/request.rb', line 21 def initialize(uri) @error_code = Request::Success @error_msg = "" @response = RestClient.get(uri.to_s) _parse_response end |
Instance Attribute Details
#error_code ⇒ Object
Returns the value of attribute error_code.
7 8 9 |
# File 'lib/bea_api/request.rb', line 7 def error_code @error_code end |
#error_msg ⇒ Object
Returns the value of attribute error_msg.
7 8 9 |
# File 'lib/bea_api/request.rb', line 7 def error_msg @error_msg end |
#notes ⇒ Object
Returns the value of attribute notes.
7 8 9 |
# File 'lib/bea_api/request.rb', line 7 def notes @notes end |
#response ⇒ Object
Returns the value of attribute response.
7 8 9 |
# File 'lib/bea_api/request.rb', line 7 def response @response end |
Class Method Details
.find(options = {}) ⇒ Object
16 17 18 19 |
# File 'lib/bea_api/request.rb', line 16 def self.find( = {}) uri = "#{BEA_URL}?#{self.to_params(options)}" response = Request.new(uri) end |