Class: Dude::ProjectManagement::Trello::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/dude/project_management/trello/client.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object



24
25
26
# File 'lib/dude/project_management/trello/client.rb', line 24

def method_missing(method, *args, &block)
  faraday_client.send(method, *args, &block)
end

Instance Method Details

#clientObject



15
16
17
18
19
20
21
22
# File 'lib/dude/project_management/trello/client.rb', line 15

def client
  @client ||= Faraday.new('https://api.trello.com/', {
    params: {
      key: Dude::SETTINGS.dig(:trello, :key),
      token: Dude::SETTINGS.dig(:trello, :token)
    }
  })
end

#fetch_current_task(id) ⇒ Object



36
37
38
# File 'lib/dude/project_management/trello/client.rb', line 36

def fetch_current_task(id)
  FetchCurrentTask.new(client, id: id).call
end

#fetch_current_tasksObject



32
33
34
# File 'lib/dude/project_management/trello/client.rb', line 32

def fetch_current_tasks
  FetchCurrentTasks.new(client).call
end

#get_task_name_by_id(id) ⇒ Object



44
45
46
# File 'lib/dude/project_management/trello/client.rb', line 44

def get_task_name_by_id(id)
  GetTaskNameById.new(client, id: id).call
end

#health_checkObject



48
49
50
51
52
# File 'lib/dude/project_management/trello/client.rb', line 48

def health_check
  client.get("/1/tokens/#{Dude::SETTINGS.dig(:trello, :token)}").status == 200
rescue StandardError
  false
end

#move_task_to_list(id, list) ⇒ Object



40
41
42
# File 'lib/dude/project_management/trello/client.rb', line 40

def move_task_to_list(id, list)
  MoveTaskToList.new(client, id: id, list_name: list).call
end

#respond_to_missing?(method_name, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/dude/project_management/trello/client.rb', line 28

def respond_to_missing?(method_name, include_private = false)
  client.respond_to?(method_name, include_private)
end