Class: ZenApi::Client
- Inherits:
-
Object
- Object
- ZenApi::Client
- Defined in:
- lib/zenapi/client.rb
Instance Attribute Summary collapse
-
#conn ⇒ Object
Returns the value of attribute conn.
Instance Method Summary collapse
-
#initialize(args = {}) ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize(args = {}) ⇒ Client
Returns a new instance of Client.
5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/zenapi/client.rb', line 5 def initialize(args = {}) raise ArgumentError, 'api_key have to be String' unless args[:api_key].is_a?(String) = { :headers => {}} [:url] ||= "https://agilezen.com/api/v1/" [:headers]['X-Zen-ApiKey'] = args[:api_key] self.conn ||= Faraday.new() do |builder| builder.use Faraday::Request::UrlEncoded builder.use Faraday::Response::Logger builder.use Faraday::Adapter::NetHttp end end |
Instance Attribute Details
#conn ⇒ Object
Returns the value of attribute conn.
3 4 5 |
# File 'lib/zenapi/client.rb', line 3 def conn @conn end |