Class: ClickUp::ConnectionManager

Inherits:
Object
  • Object
show all
Defined in:
lib/click_up/connection_manager.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path, data) ⇒ ConnectionManager



7
8
9
10
# File 'lib/click_up/connection_manager.rb', line 7

def initialize(path, data)
  @path = path
  @data = data
end

Instance Attribute Details

#dataObject (readonly)

Returns the value of attribute data.



5
6
7
# File 'lib/click_up/connection_manager.rb', line 5

def data
  @data
end

#pathObject (readonly)

Returns the value of attribute path.



5
6
7
# File 'lib/click_up/connection_manager.rb', line 5

def path
  @path
end

Instance Method Details

#getObject



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

def get
  net_http_response = https_client.request_get(resource_url.path, default_headers)
  format_response(net_http_response.body)
end

#postObject



17
18
19
20
21
# File 'lib/click_up/connection_manager.rb', line 17

def post
  form_data = data.to_json if data.is_a?(Hash) && data.size > 0
  net_http_response = https_client.request_post(resource_url.path, form_data, default_headers)
  format_response(net_http_response.body)
end