class CSVPP::FormatsClient
Constants
- DEFAULT_HOST
Public Class Methods
new(host: DEFAULT_HOST)
click to toggle source
# File lib/csvpp/formats_client.rb, line 11 def initialize(host: DEFAULT_HOST) self.class.base_uri ENV['FORMATS_HOST'] || host end
Public Instance Methods
base_uri()
click to toggle source
@return [String] e.g. “formats.iapps.swissdrg.local”
# File lib/csvpp/formats_client.rb, line 16 def base_uri self.class.base_uri end
format(name)
click to toggle source
@param name [String] @return [Format]
# File lib/csvpp/formats_client.rb, line 27 def format(name) response = self.class.get("/api/formats/#{name}") if (error = response['error']) raise ArgumentError, %{#{error} "#{name}"} end Format.new(response) end
formats()
click to toggle source
@return [Array<Format>]
# File lib/csvpp/formats_client.rb, line 21 def formats self.class.get('/api/formats').map { |hash| Format.new(hash) } end