Class: AlephApi::XServicesClient
- Inherits:
-
Object
- Object
- AlephApi::XServicesClient
- Defined in:
- lib/aleph_api/x_services_client.rb
Instance Attribute Summary collapse
-
#host ⇒ Object
Returns the value of attribute host.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
- #get(params = {}) ⇒ Object
-
#initialize(options = {}) ⇒ XServicesClient
constructor
A new instance of XServicesClient.
- #post(params = {}) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ XServicesClient
Returns a new instance of XServicesClient.
12 13 14 15 16 17 |
# File 'lib/aleph_api/x_services_client.rb', line 12 def initialize( = {}) .symbolize_keys.try do || @host = ([:host] || ENV["ALEPH_X_XSERVICES_HOST"] || ENV["ALEPH_API_HOST"]).try(:strip) @url = ([:url] || ENV["ALEPH_X_SERVICES_URL"]).try(:strip) end end |
Instance Attribute Details
#host ⇒ Object
Returns the value of attribute host.
5 6 7 |
# File 'lib/aleph_api/x_services_client.rb', line 5 def host @host end |
#url ⇒ Object
Returns the value of attribute url.
6 7 8 |
# File 'lib/aleph_api/x_services_client.rb', line 6 def url @url end |
Instance Method Details
#get(params = {}) ⇒ Object
19 20 21 |
# File 'lib/aleph_api/x_services_client.rb', line 19 def get(params = {}) Faraday.get(self.url, params).body end |
#post(params = {}) ⇒ Object
23 24 25 |
# File 'lib/aleph_api/x_services_client.rb', line 23 def post(params = {}) Faraday.post(self.url, params).body end |