Class: Tender::Client
- Inherits:
-
Object
- Object
- Tender::Client
- Includes:
- Discussion
- Defined in:
- lib/tender/client.rb
Instance Attribute Summary collapse
-
#api_token ⇒ Object
Returns the value of attribute api_token.
-
#domain ⇒ Object
Returns the value of attribute domain.
-
#domain_format ⇒ Object
Returns the value of attribute domain_format.
-
#host_format ⇒ Object
Returns the value of attribute host_format.
-
#password ⇒ Object
Returns the value of attribute password.
-
#port ⇒ Object
Returns the value of attribute port.
-
#protocol ⇒ Object
Returns the value of attribute protocol.
Instance Method Summary collapse
- #connection ⇒ Object
-
#initialize(domain, api_token) ⇒ Client
constructor
A new instance of Client.
Methods included from Discussion
#create_discussion, #get_discussions
Constructor Details
#initialize(domain, api_token) ⇒ Client
Returns a new instance of Client.
8 9 10 11 |
# File 'lib/tender/client.rb', line 8 def initialize(domain, api_token) self.domain = domain # 'tender-api-testing' self.api_token = api_token # 'b19343da7748bd4e97d13fcc8b76304a039eb801' end |
Instance Attribute Details
#api_token ⇒ Object
Returns the value of attribute api_token.
6 7 8 |
# File 'lib/tender/client.rb', line 6 def api_token @api_token end |
#domain ⇒ Object
Returns the value of attribute domain.
6 7 8 |
# File 'lib/tender/client.rb', line 6 def domain @domain end |
#domain_format ⇒ Object
Returns the value of attribute domain_format.
6 7 8 |
# File 'lib/tender/client.rb', line 6 def domain_format @domain_format end |
#host_format ⇒ Object
Returns the value of attribute host_format.
6 7 8 |
# File 'lib/tender/client.rb', line 6 def host_format @host_format end |
#password ⇒ Object
Returns the value of attribute password.
6 7 8 |
# File 'lib/tender/client.rb', line 6 def password @password end |
#port ⇒ Object
Returns the value of attribute port.
6 7 8 |
# File 'lib/tender/client.rb', line 6 def port @port end |
#protocol ⇒ Object
Returns the value of attribute protocol.
6 7 8 |
# File 'lib/tender/client.rb', line 6 def protocol @protocol end |
Instance Method Details
#connection ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/tender/client.rb', line 13 def connection @conn ||= Faraday.new(url: "https://api.tenderapp.com/#{self.domain}" ) do |faraday| faraday.use FaradayMiddleware::EncodeJson faraday.use FaradayMiddleware::ParseJson, :content_type => /\bjson$/ faraday.adapter Faraday.default_adapter end @conn.headers['Accept'] = "application/vnd.tender-v1+json" @conn.headers['X-Tender-Auth'] = self.api_token @conn end |