Class: PortfolioManager::REST::Request
- Inherits:
-
Object
- Object
- PortfolioManager::REST::Request
- Defined in:
- lib/portfolio_manager/rest/request.rb
Overview
Manage HTTP requests
Constant Summary collapse
- BASE_URL =
'https://portfoliomanager.energystar.gov'
- LIVE_PATH =
'/ws'
- TEST_PATH =
'/wstest'
- CONTENT_TYPE =
'application/xml'
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#options ⇒ Object
Returns the value of attribute options.
-
#parser ⇒ Object
readonly
Returns the value of attribute parser.
-
#path ⇒ Object
readonly
Returns the value of attribute path.
-
#request_method ⇒ Object
readonly
Returns the value of attribute request_method.
Instance Method Summary collapse
-
#initialize(client, request_method, path, options) ⇒ Request
constructor
A new instance of Request.
- #perform ⇒ Hash
Constructor Details
#initialize(client, request_method, path, options) ⇒ Request
Returns a new instance of Request.
25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/portfolio_manager/rest/request.rb', line 25 def initialize(client, request_method, path, ) @client = client @path = api_environment + path @options = @request_method = request_method @conn = Faraday.new(url: BASE_URL) do |conn| conn.request :authorization, :basic, client.username, client.password conn.request :xml end @parser = Nori.new setup_client end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
17 18 19 |
# File 'lib/portfolio_manager/rest/request.rb', line 17 def client @client end |
#options ⇒ Object
Returns the value of attribute options.
18 19 20 |
# File 'lib/portfolio_manager/rest/request.rb', line 18 def @options end |
#parser ⇒ Object (readonly)
Returns the value of attribute parser.
17 18 19 |
# File 'lib/portfolio_manager/rest/request.rb', line 17 def parser @parser end |
#path ⇒ Object (readonly)
Returns the value of attribute path.
17 18 19 |
# File 'lib/portfolio_manager/rest/request.rb', line 17 def path @path end |
#request_method ⇒ Object (readonly)
Returns the value of attribute request_method.
17 18 19 |
# File 'lib/portfolio_manager/rest/request.rb', line 17 def request_method @request_method end |
Instance Method Details
#perform ⇒ Hash
40 41 42 |
# File 'lib/portfolio_manager/rest/request.rb', line 40 def perform parser.parse(response_body) end |