Class: Tacokit::Client

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Includes:
Authorization, Actions, Boards, Cards, Checklists, Labels, Lists, Members, Notifications, Organizations, Searches, Tokens, Types, Webhooks, Utils
Defined in:
lib/tacokit/client.rb,
lib/tacokit/client/cards.rb,
lib/tacokit/client/lists.rb,
lib/tacokit/client/types.rb,
lib/tacokit/client/boards.rb,
lib/tacokit/client/labels.rb,
lib/tacokit/client/tokens.rb,
lib/tacokit/client/actions.rb,
lib/tacokit/client/members.rb,
lib/tacokit/client/searches.rb,
lib/tacokit/client/webhooks.rb,
lib/tacokit/client/checklists.rb,
lib/tacokit/client/notifications.rb,
lib/tacokit/client/organizations.rb

Defined Under Namespace

Modules: Actions, Boards, Cards, Checklists, Labels, Lists, Members, Notifications, Organizations, Searches, Tokens, Types, Webhooks

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Webhooks

#create_webhook, #delete_webhook, #update_webhook, #webhook, #webhook_path

Methods included from Types

#type

Methods included from Tokens

#delete_token, #token, #token_path, #token_resource

Methods included from Searches

#search, #search_members, #search_path

Methods included from Organizations

#create_organization, #delete_organization, #organization, #organization_path, #organization_resource, #update_organization

Methods included from Notifications

#notification, #update_notification

Methods included from Members

#actions, #boards, #cards, #member, #notifications, #organizations, #tokens, #update_member

Methods included from Lists

#archive_list_cards, #create_list, #list, #list_actions, #list_board, #list_cards, #move_list_cards, #update_list

Methods included from Labels

#create_label, #delete_label, #label, #update_label

Methods included from Checklists

#add_checklist_check_item, #check_items, #checklist, #checklist_board, #checklist_card, #create_checklist, #delete_checklist, #update_checklist

Methods included from Cards

#add_checklist, #add_comment, #add_label, #add_member_to_card, #add_sticker, #archive_card, #attach_file, #attachment, #attachments, #card, #card_actions, #card_board, #card_list, #card_members, #card_members_voted, #check_item_states, #checklists, #convert_to_card, #copy_checklist, #create_card, #create_card_resource, #delete_card, #move_card, #remove_attachment, #remove_card_member, #remove_checklist, #remove_comment, #remove_label, #remove_sticker, #remove_vote, #restore_card, #stickers, #subscribe_to_card, #unsubscribe_from_card, #update_card, #update_card_name, #update_card_resource, #update_check_item, #update_comment, #vote

Methods included from Boards

#add_board_member, #board, #board_actions, #board_cards, #board_checklists, #board_labels, #board_members, #board_organization, #board_preferences, #board_stars, #create_board, #lists, #update_board, #update_board_member

Methods included from Actions

#action, #action_board, #action_card, #action_entities, #action_list, #action_member, #action_member_creator, #action_organization, #delete_action, #update_action, #update_action_text

Methods included from Utils

#base_path, #blank?, #camel_join, #camel_path, #camelize, #constantize, #deep_transform_keys, #extract_options, #path_join, #present?, #singularize, #underscore

Methods included from Authorization

#authorize, #authorize_url, #get_app_key

Constructor Details

#initialize(options = {}) ⇒ Client

Returns a new instance of Client.



57
58
59
# File 'lib/tacokit/client.rb', line 57

def initialize(options = {})
  configuration.options = options
end

Instance Attribute Details

#last_responseObject

Returns the value of attribute last_response.



55
56
57
# File 'lib/tacokit/client.rb', line 55

def last_response
  @last_response
end

Instance Method Details

#configurationObject



69
70
71
# File 'lib/tacokit/client.rb', line 69

def configuration
  @configuration ||= Configuration.new
end

#configure {|configuration| ... } ⇒ Object

Yields:



65
66
67
# File 'lib/tacokit/client.rb', line 65

def configure
  yield configuration if block_given?
end

#delete(url, options = {}) ⇒ Object



85
86
87
# File 'lib/tacokit/client.rb', line 85

def delete(url, options = {})
  request :delete, url, options
end

#get(url, options = {}) ⇒ Object



73
74
75
# File 'lib/tacokit/client.rb', line 73

def get(url, options = {})
  request :get, url, options
end

#paginated_get(*args) ⇒ Object



89
90
91
# File 'lib/tacokit/client.rb', line 89

def paginated_get(*args)
  Collection.new(self, :get, *args)
end

#post(url, options = {}) ⇒ Object



77
78
79
# File 'lib/tacokit/client.rb', line 77

def post(url, options = {})
  request :post, url, options
end

#put(url, options = {}) ⇒ Object



81
82
83
# File 'lib/tacokit/client.rb', line 81

def put(url, options = {})
  request :put, url, options
end

#request(method, url, data = nil, params = nil) ⇒ Object



93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# File 'lib/tacokit/client.rb', line 93

def request(method, url, data = nil, params = nil)
  if [:get, :body].include?(method)
    params ||= data
    data      = nil
  end

  response = connection.send method, url do |req|
    req.params.update serialize_params(params)
    req.body = serialize(data) if data
  end

  @last_response = last_response = Response.new(self, response)

  last_response.data
end

#reset!Object



61
62
63
# File 'lib/tacokit/client.rb', line 61

def reset!
  @configuration = nil
end

#to_sObject Also known as: inspect



109
110
111
# File 'lib/tacokit/client.rb', line 109

def to_s
  "<#{self.class}:#{object_id}>"
end