Class: FlockOs::Client
- Inherits:
-
Object
- Object
- FlockOs::Client
- Defined in:
- lib/flock_os/client.rb
Constant Summary collapse
- BASE_URL =
'https://api.flock.co/v1'.freeze
Instance Method Summary collapse
- #channels ⇒ Object
- #chat ⇒ Object
-
#initialize(options = {}) {|config| ... } ⇒ Client
constructor
A new instance of Client.
- #post(url, params = {}) ⇒ Object
- #rooster ⇒ Object
- #users ⇒ Object
Constructor Details
#initialize(options = {}) {|config| ... } ⇒ Client
Returns a new instance of Client.
31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/flock_os/client.rb', line 31 def initialize( = {}) config = FlockOs::Configuration.new() yield config if block_given? @connection = Faraday.new(url: BASE_URL) do |conn| conn.params[:token] = config.token conn.request :json conn.response :json # conn.use ::Middleware::HandleResponseException conn.adapter Faraday.default_adapter end end |
Instance Method Details
#channels ⇒ Object
46 47 48 |
# File 'lib/flock_os/client.rb', line 46 def channels @channels ||= FlockOs::Api::Channels.new(self) end |
#chat ⇒ Object
50 51 52 |
# File 'lib/flock_os/client.rb', line 50 def chat @chat ||= FlockOs::Api::Chat.new(self) end |
#post(url, params = {}) ⇒ Object
62 63 64 65 |
# File 'lib/flock_os/client.rb', line 62 def post(url, params = {}) response = @connection.post(url, params) response.body end |