Class: Idobata::Client
- Inherits:
-
Object
- Object
- Idobata::Client
- Defined in:
- lib/idobata/client.rb
Instance Method Summary collapse
-
#initialize(hook_url) ⇒ Client
constructor
A new instance of Client.
- #post(args) ⇒ Object
Constructor Details
#initialize(hook_url) ⇒ Client
Returns a new instance of Client.
5 6 7 8 9 10 11 12 13 |
# File 'lib/idobata/client.rb', line 5 def initialize(hook_url) default_header = { 'User-Agent' => "Idobata / RubyBinding/#{Idobata::VERSION}" } @conn = Faraday.new(hook_url, headers: default_header) do |builder| builder.request :url_encoded builder.adapter Faraday.default_adapter end end |
Instance Method Details
#post(args) ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/idobata/client.rb', line 15 def post(args) begin @conn.post(nil, args) rescue Faraday::Error::ClientError => e raise e end end |