Class: ClickUp::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/click_up/client.rb,
lib/click_up/client/version.rb,
lib/click_up/client/http_client.rb

Defined Under Namespace

Classes: HttpClient

Constant Summary collapse

VERSION =
"0.2.0"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Client

Returns a new instance of Client.



14
15
16
17
18
19
# File 'lib/click_up/client.rb', line 14

def initialize(options = {})
  @api_token = options.fetch(:api_token)
  @default_list_id = options.fetch(:default_list_id, nil)

  @http_client = HttpClient.new(api_token: @api_token)
end

Instance Attribute Details

#api_tokenObject (readonly)

Returns the value of attribute api_token.



12
13
14
# File 'lib/click_up/client.rb', line 12

def api_token
  @api_token
end

#default_list_idObject (readonly)

Returns the value of attribute default_list_id.



12
13
14
# File 'lib/click_up/client.rb', line 12

def default_list_id
  @default_list_id
end

Instance Method Details

#tasks(list_id: @default_list_id) ⇒ Object

Raises:

  • (ArgumentError)


21
22
23
24
25
# File 'lib/click_up/client.rb', line 21

def tasks(list_id: @default_list_id)
  raise ArgumentError, "list_id can't be nil when default_list_id was not provided" if list_id.nil?

  ClickUp::Tasks::Service.new(list_id: list_id, http_client: @http_client)
end