Class: ResoTransport::Datasystem
- Inherits:
-
BaseMetadata
- Object
- BaseMetadata
- ResoTransport::Datasystem
- Defined in:
- lib/reso_transport/datasystem.rb
Constant Summary
Constants inherited from BaseMetadata
Instance Attribute Summary
Attributes inherited from BaseMetadata
Instance Method Summary collapse
-
#initialize(client) ⇒ Datasystem
constructor
A new instance of Datasystem.
- #localizations_for(resource_name) ⇒ Object
- #response ⇒ Object
Methods inherited from BaseMetadata
#cache, #cache_file, #classname, #data, #parser, #prefix, #raw, #request
Constructor Details
#initialize(client) ⇒ Datasystem
Returns a new instance of Datasystem.
5 6 7 8 9 |
# File 'lib/reso_transport/datasystem.rb', line 5 def initialize(client) super client @prefix = 'ds' @classname = self.class.name end |
Instance Method Details
#localizations_for(resource_name) ⇒ Object
11 12 13 14 |
# File 'lib/reso_transport/datasystem.rb', line 11 def localizations_for(resource_name) localizations = parser.resources.dig(resource_name, 'Localizations') || [] localizations.map { |l| [l['Name'], l] }.to_h end |
#response ⇒ Object
16 17 18 19 20 21 22 23 |
# File 'lib/reso_transport/datasystem.rb', line 16 def response @response ||= client.connection.get('DataSystem') do |req| req.headers['Accept'] = 'application/json' @request = req end rescue Faraday::ConnectionFailed raise NoResponse.new(request, nil, 'DataSystem') end |