Class: Bloomy::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/bloomy/client.rb

Overview

The Client class is the main entry point for interacting with the Bloomy API. It provides methods for managing users, todos, rocks, meetings, measurables, and issues.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_key = nil) ⇒ Client

Initializes a new Client instance

Examples:

client = Bloomy::Client.new
client.meetings.list
client.user.details
client.meeting.delete(id)


24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/bloomy/client.rb', line 24

def initialize(api_key = nil)
  @configuration = Configuration.new unless api_key
  @api_key = api_key || @configuration.api_key
  @base_url = "https://app.bloomgrowth.com/api/v1"
  @conn = Faraday.new(url: @base_url) do |faraday|
    faraday.response :json
    faraday.adapter Faraday.default_adapter
    faraday.headers["Accept"] = "*/*"
    faraday.headers["Content-Type"] = "application/json"
    faraday.headers["Authorization"] = "Bearer #{@api_key}"
  end
  @user = User.new(@conn)
  @user_id = @user.default_user_id
  @todo = Todo.new(@conn, @user_id)
  @rock = Rock.new(@conn, @user_id)
  @meeting = Meeting.new(@conn, @user_id)
  @measurable = Measurable.new(@conn, @user_id)
  @issue = Issue.new(@conn, @user_id)
end

Instance Attribute Details

#configurationObject (readonly)

Returns the value of attribute configuration.



15
16
17
# File 'lib/bloomy/client.rb', line 15

def configuration
  @configuration
end

#issueObject (readonly)

Returns the value of attribute issue.



15
16
17
# File 'lib/bloomy/client.rb', line 15

def issue
  @issue
end

#measurableObject (readonly)

Returns the value of attribute measurable.



15
16
17
# File 'lib/bloomy/client.rb', line 15

def measurable
  @measurable
end

#meetingObject (readonly)

Returns the value of attribute meeting.



15
16
17
# File 'lib/bloomy/client.rb', line 15

def meeting
  @meeting
end

#rockObject (readonly)

Returns the value of attribute rock.



15
16
17
# File 'lib/bloomy/client.rb', line 15

def rock
  @rock
end

#todoObject (readonly)

Returns the value of attribute todo.



15
16
17
# File 'lib/bloomy/client.rb', line 15

def todo
  @todo
end

#userObject (readonly)

Returns the value of attribute user.



15
16
17
# File 'lib/bloomy/client.rb', line 15

def user
  @user
end