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 Bloom Growth features.

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)

Raises:

  • (ArgumentError)


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

def initialize(api_key = nil)
  @configuration = Configuration.new unless api_key
  @api_key = api_key || @configuration.api_key

  raise ArgumentError, "No API key provided. Set it in configuration or pass it directly." unless @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)
  @todo = Todo.new(@conn)
  @goal = Goal.new(@conn)
  @meeting = Meeting.new(@conn)
  @scorecard = Scorecard.new(@conn)
  @issue = Issue.new(@conn)
  @headline = Headline.new(@conn)
end

Instance Attribute Details

#configurationObject (readonly)

Returns the value of attribute configuration.



17
18
19
# File 'lib/bloomy/client.rb', line 17

def configuration
  @configuration
end

#goalObject (readonly)

Returns the value of attribute goal.



17
18
19
# File 'lib/bloomy/client.rb', line 17

def goal
  @goal
end

#headlineObject (readonly)

Returns the value of attribute headline.



17
18
19
# File 'lib/bloomy/client.rb', line 17

def headline
  @headline
end

#issueObject (readonly)

Returns the value of attribute issue.



17
18
19
# File 'lib/bloomy/client.rb', line 17

def issue
  @issue
end

#meetingObject (readonly)

Returns the value of attribute meeting.



17
18
19
# File 'lib/bloomy/client.rb', line 17

def meeting
  @meeting
end

#scorecardObject (readonly)

Returns the value of attribute scorecard.



17
18
19
# File 'lib/bloomy/client.rb', line 17

def scorecard
  @scorecard
end

#todoObject (readonly)

Returns the value of attribute todo.



17
18
19
# File 'lib/bloomy/client.rb', line 17

def todo
  @todo
end

#userObject (readonly)

Returns the value of attribute user.



17
18
19
# File 'lib/bloomy/client.rb', line 17

def user
  @user
end