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

Methods included from Types

#type

Methods included from Tokens

#delete_token, #token, #token_resource

Methods included from Searches

#search, #search_members

Methods included from Organizations

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

Methods included from Notifications

#mark_notification_read, #mark_notification_unread, #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?, #resource_id, #resource_path, #singularize, #underscore

Methods included from Authorization

#authorize, #authorize_url, #get_app_key

Constructor Details

#initialize(options = {}) ⇒ Client

Returns a new instance of Client.


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

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

Instance Attribute Details

#last_responseObject

Returns the value of attribute last_response


53
54
55
# File 'lib/tacokit/client.rb', line 53

def last_response
  @last_response
end

Instance Method Details

#configurationObject


67
68
69
# File 'lib/tacokit/client.rb', line 67

def configuration
  @configuration ||= Configuration.new
end

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

Yields:


63
64
65
# File 'lib/tacokit/client.rb', line 63

def configure
  yield configuration if block_given?
end

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


83
84
85
# File 'lib/tacokit/client.rb', line 83

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

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


71
72
73
# File 'lib/tacokit/client.rb', line 71

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

#paginated_get(*args) ⇒ Object


87
88
89
# File 'lib/tacokit/client.rb', line 87

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

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


75
76
77
# File 'lib/tacokit/client.rb', line 75

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

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


79
80
81
# File 'lib/tacokit/client.rb', line 79

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

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


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

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


59
60
61
# File 'lib/tacokit/client.rb', line 59

def reset!
  @configuration = nil
end

#to_sObject Also known as: inspect


107
108
109
# File 'lib/tacokit/client.rb', line 107

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