Class: CircuitApi::Client
- Inherits:
-
Object
- Object
- CircuitApi::Client
- Defined in:
- lib/circuit_api/client.rb
Instance Attribute Summary collapse
-
#client_id ⇒ Object
Returns the value of attribute client_id.
-
#client_secret ⇒ Object
Returns the value of attribute client_secret.
-
#sandbox ⇒ Object
Returns the value of attribute sandbox.
-
#token ⇒ Object
Returns the value of attribute token.
Instance Method Summary collapse
- #api_url ⇒ Object
- #base_url ⇒ Object
- #connect(token) ⇒ Object
- #conversations ⇒ Object
-
#initialize(client_id: nil, client_secret: nil, sandbox: nil) ⇒ Client
constructor
A new instance of Client.
- #labels ⇒ Object
- #messages ⇒ Object
- #presence ⇒ Object
- #rtc_sessions ⇒ Object
- #users ⇒ Object
- #webhooks ⇒ Object
Constructor Details
#initialize(client_id: nil, client_secret: nil, sandbox: nil) ⇒ Client
Returns a new instance of Client.
5 6 7 8 9 |
# File 'lib/circuit_api/client.rb', line 5 def initialize(client_id: nil, client_secret: nil, sandbox: nil) @client_id = client_id @client_secret = client_secret @sandbox = sandbox end |
Instance Attribute Details
#client_id ⇒ Object
Returns the value of attribute client_id.
3 4 5 |
# File 'lib/circuit_api/client.rb', line 3 def client_id @client_id end |
#client_secret ⇒ Object
Returns the value of attribute client_secret.
3 4 5 |
# File 'lib/circuit_api/client.rb', line 3 def client_secret @client_secret end |
#sandbox ⇒ Object
Returns the value of attribute sandbox.
3 4 5 |
# File 'lib/circuit_api/client.rb', line 3 def sandbox @sandbox end |
#token ⇒ Object
Returns the value of attribute token.
3 4 5 |
# File 'lib/circuit_api/client.rb', line 3 def token @token end |
Instance Method Details
#api_url ⇒ Object
22 23 24 |
# File 'lib/circuit_api/client.rb', line 22 def api_url URI.join(base_url, CircuitApi::API_PATH_BASE) end |
#base_url ⇒ Object
16 17 18 19 20 |
# File 'lib/circuit_api/client.rb', line 16 def base_url return CircuitApi::API_SANDBOX_BASE_URL if sandbox CircuitApi::API_BASE_URL end |
#connect(token) ⇒ Object
11 12 13 14 |
# File 'lib/circuit_api/client.rb', line 11 def connect(token) # TODO: fetch oauth token @token = token end |
#conversations ⇒ Object
26 27 28 |
# File 'lib/circuit_api/client.rb', line 26 def conversations CircuitApi::Resources::Conversation.new(self) end |
#labels ⇒ Object
30 31 32 |
# File 'lib/circuit_api/client.rb', line 30 def labels CircuitApi::Resources::Label.new(self) end |
#messages ⇒ Object
34 35 36 |
# File 'lib/circuit_api/client.rb', line 34 def CircuitApi::Resources::Message.new(self) end |
#presence ⇒ Object
38 39 40 |
# File 'lib/circuit_api/client.rb', line 38 def presence CircuitApi::Resources::Presence.new(self) end |
#rtc_sessions ⇒ Object
42 43 44 |
# File 'lib/circuit_api/client.rb', line 42 def rtc_sessions CircuitApi::Resources::RtcSession.new(self) end |
#users ⇒ Object
46 47 48 |
# File 'lib/circuit_api/client.rb', line 46 def users CircuitApi::Resources::User.new(self) end |
#webhooks ⇒ Object
50 51 52 |
# File 'lib/circuit_api/client.rb', line 50 def webhooks CircuitApi::Resources::Webhook.new(self) end |