Class: Ekispert::Client
- Inherits:
-
Object
- Object
- Ekispert::Client
- Defined in:
- lib/ekispert/client.rb
Class Method Summary collapse
Class Method Details
.connection_options ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/ekispert/client.rb', line 11 def self. { url: "#{Config.host}/#{Config.version}/xml", proxy: Config.http_proxy, headers: { 'Content-Type' => 'application/xml;charset=utf-8' }, params: { key: Ekispert::Config.api_key }, request: { timeout: 5, open_timeout: 2 } } end |
.get(path, params = nil) ⇒ Object
3 4 5 6 7 8 9 |
# File 'lib/ekispert/client.rb', line 3 def self.get(path, params=nil) set_connection if @connection.nil? || res = @connection.get(path, params) return parse_xml(res.body) if res.status == 200 raise_error(res) end |
.set_connection ⇒ Object
21 22 23 24 25 26 |
# File 'lib/ekispert/client.rb', line 21 def self.set_connection = @connection = Faraday.new() do |c| c.adapter Faraday.default_adapter end end |