Class: Getevents::Client
- Inherits:
-
Object
- Object
- Getevents::Client
- Defined in:
- lib/getevents/client.rb
Constant Summary collapse
- URL =
"https://api.getevents.co"
Instance Attribute Summary collapse
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
Instance Method Summary collapse
- #account_id ⇒ Object
-
#initialize ⇒ Client
constructor
A new instance of Client.
- #test_mode? ⇒ Boolean
- #token ⇒ Object
Constructor Details
#initialize ⇒ Client
Returns a new instance of Client.
6 7 8 9 10 11 12 13 14 15 |
# File 'lib/getevents/client.rb', line 6 def initialize if test_mode? @connection = Getevents::FakeClient.new else @connection = Faraday.new(url: URL) do |faraday| faraday.headers["Authorization"] = "GetEvents #{account_id}:#{token}" faraday.adapter Faraday.default_adapter end end end |
Instance Attribute Details
#connection ⇒ Object (readonly)
Returns the value of attribute connection.
4 5 6 |
# File 'lib/getevents/client.rb', line 4 def connection @connection end |
Instance Method Details
#account_id ⇒ Object
17 18 19 |
# File 'lib/getevents/client.rb', line 17 def account_id Getevents.configuration.account_id end |
#test_mode? ⇒ Boolean
25 26 27 |
# File 'lib/getevents/client.rb', line 25 def test_mode? Getevents.configuration.test_mode end |
#token ⇒ Object
21 22 23 |
# File 'lib/getevents/client.rb', line 21 def token Getevents.configuration.token end |