Module: Wits::Client
- Defined in:
- lib/wits/client.rb
Class Method Summary collapse
Class Method Details
.client ⇒ Object
23 24 25 26 27 28 |
# File 'lib/wits/client.rb', line 23 def self.client @client ||= Faraday.new(url: 'https://www.electricityinfo.co.nz') do |connection| connection.adapter Faraday.default_adapter connection.use Faraday::Response::RaiseError end end |
.get(*args, &block) ⇒ Object
17 18 19 20 21 |
# File 'lib/wits/client.rb', line 17 def self.get(*args, &block) client.get(*args, &block) rescue Faraday::ClientError => error handle_error(error) end |
.get_csv(*args, &block) ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/wits/client.rb', line 9 def self.get_csv(*args, &block) response = get(*args, &block) check_for_data(response) response end |