Class: CONTENTdmAPI::Request
- Inherits:
-
Object
- Object
- CONTENTdmAPI::Request
- Defined in:
- lib/contentdm_api/request.rb
Overview
Form requests to the ContentDM API
Instance Attribute Summary collapse
-
#base_url ⇒ Object
readonly
Returns the value of attribute base_url.
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#service ⇒ Object
readonly
Returns the value of attribute service.
Instance Method Summary collapse
-
#fetch ⇒ String
Fetch data from the CONTENTdm API.
- #initialize(base_url: '', client: HTTP, service: Service.new) ⇒ Void constructor
-
#unencoded_url ⇒ String
A URL for a given service.
Constructor Details
Instance Attribute Details
#base_url ⇒ Object (readonly)
Returns the value of attribute base_url.
6 7 8 |
# File 'lib/contentdm_api/request.rb', line 6 def base_url @base_url end |
#client ⇒ Object (readonly)
Returns the value of attribute client.
6 7 8 |
# File 'lib/contentdm_api/request.rb', line 6 def client @client end |
#service ⇒ Object (readonly)
Returns the value of attribute service.
6 7 8 |
# File 'lib/contentdm_api/request.rb', line 6 def service @service end |
Instance Method Details
#fetch ⇒ String
Fetch data from the CONTENTdm API
23 24 25 |
# File 'lib/contentdm_api/request.rb', line 23 def fetch client.get(unencoded_url).to_s end |
#unencoded_url ⇒ String
A URL for a given service
30 31 32 |
# File 'lib/contentdm_api/request.rb', line 30 def unencoded_url "#{base_url}?q=#{service.url_params}" end |