module Tacokit::Client::Members

Methods for the Members API @see developers.trello.com/advanced-reference/member

Public Instance Methods

actions(username = "me", options = {}) click to toggle source

@overload actions(username = “me”, options = nil)

Retrieve a member's actions
@param username [String, Tacokit::Resource<Member>] the username or member resource
@param options [Hash] the options to fetch the actions with
@return [Tacokit::Collection<Action>] the actions collection
@example fetch the actions for the member named 'tacokit'
  Tacokit.actions("tacokit") #=> Tacokit::Collection<Member>

@overload actions(options = nil)

Retrieve the current member's actions
@param options [Hash] the options to fetch the actions with
@return [Tacokit::Collection] the action resources
@example fetch the current member's actions
  Tacokit.actions #=> Tacokit::Collection<Action>
@example fetch the current member's card comment actions only
  Tacokit.actions(filter: "comment_card") #=> Tacokit::Collection<Action>

@see developers.trello.com/advanced-reference/member#get-1-members-idmember-or-username-actions

# File lib/tacokit/client/members.rb, line 46
def actions(username = "me", options = {})
  username, options = extract_member_args(username, options)
  paginated_get member_path(username, "actions"), options
end
Also aliased as: member_actions
boards(username = "me", options = {}) click to toggle source

@overload boards(username = “me”, options = {})

Retrieve a member's boards
@param username [String, Tacokit::Resource<Member>] the username or member resource
@param options [Hash] the options to fetch the boards with
@return [Tacokit::Collection<Board>] the boards collection
@example fetch the boards for the member named 'tacokit'
  Tacokit.boards("tacokit") #=> Tacokit::Collection<Board>

@overload boards(options = {})

Retrieve current member's boards
@param options [Hash] the options to fetch the boards with
@return [Tacokit::Resource] the boards collection
@example fetch the current member's boards
  Tacokit.boards #=> Tacokit::Collection<Board>
@example fetch the current member's open boards only
  Tacokit.boards(filter: "all") #=> Tacokit::Collection<Board>

@see developers.trello.com/advanced-reference/member#get-1-members-idmember-or-username-boards

# File lib/tacokit/client/members.rb, line 68
def boards(username = "me", options = {})
  username, options = extract_member_args(username, options)
  get member_path(username, "boards"), options
end
cards(username = "me", options = {}) click to toggle source

@overload cards(username = “me”, options = {})

Retrieve a member's cards
@param username [String, Tacokit::Resource<Member>] the username or member resource
@param options [Hash] the options to fetch the cards with
@return [Tacokit::Collection<Card>] the cards collection
@example fetch the cards for the member named 'tacokit'
  Tacokit.cards("tacokit") #=> Tacokit::Collection<Card>

@overload cards(options = {})

Retrieve current member's cards
@param options [Hash] the options to fetch the cards with
@return [Tacokit::Collection<Card>] the cards collection
@example fetch the current member's boards
  Tacokit.cards #=> Tacokit::Collection<Card>
@example fetch the current member's closed cards only
  Tacokit.cards(filter: "closed") #=> Tacokit::Collection<Card>

@see developers.trello.com/advanced-reference/member#get-1-members-idmember-or-username-cards

# File lib/tacokit/client/members.rb, line 89
def cards(username = "me", options = {})
  username, options = extract_member_args(username, options)
  get member_path(username, "cards"), options
end
member(username = "me", options = nil) click to toggle source

@overload member(username = “me”, options = nil)

Retrieve a Trello member by username
@param username [String] the member's username
@param options [Hash] the options to fetch the member with
@return [Tacokit::Resource<Member>] the member resource
@example fetch the member named 'rossta'
  Tacokit.member("tacokit") #=> Tacokit::Resource<Member>

@overload member(options)

Retrieve the current member
@param options [Hash] the options to fetch the member with
@return [Tacokit::Resource<Member>] the member resource
@example fetch the current member
  Tacokit.member #=> Tacokit::Resource<Member>
@example fetch the current member with all boards
  Tacokit.member(boards: "all") #=> Tacokit::Resource<Member>
@example configure a local client and fetch different current member
  client = Tacokit::Client.new app_key: "another-app-key"
  client.member #=> Tacokit::Resource<Member>

@see developers.trello.com/advanced-reference/member#get-1-members-idmember-or-username

# File lib/tacokit/client/members.rb, line 25
def member(username = "me", options = nil)
  username, options = extract_member_args(username, options)
  get member_path(username), options
end
member_actions(username = "me", options = {})
Alias for: actions
notifications(username = "me", options = {}) click to toggle source

@overload notifications(username = “me”, options = {})

Retrieve a member's notifications
@param username [String, Tacokit::Resource<Member>] the username or member resource
@param options [Hash] the options to fetch the notifications with
@return [Tacokit::Collection<Notification>] the notifications collection
@example fetch the notifications for the member named 'tacokit'
  Tacokit.notifications("tacokit") #=> Tacokit::Collection<Notification>

@overload notifications(options = {})

Retrieve current member's notifications
@param options [Hash] the options to fetch the notifications with
@return [Tacokit::Collection<Notification>] the notifications collection
@example fetch the current member's boards
  Tacokit.notifications #=> Tacokit::Collection<Notification>
@example fetch the current member's closed notifications only
  Tacokit.notifications(filter: "closed") #=> Tacokit::Collection<Notification>

@see developers.trello.com/advanced-reference/member#get-1-members-idmember-or-username-notifications

# File lib/tacokit/client/members.rb, line 110
def notifications(username = "me", options = {})
  username, options = extract_member_args(username, options)
  paginated_get member_path(username, "notifications"), options
end
organizations(username = "me", options = {}) click to toggle source

@overload organizations(username = “me”, options = {})

Retrieve a member's organizations
@param username [String, Tacokit::Resource<Member>] the username or member resource
@param options [Hash] the options to fetch the organizations with
@return [Tacokit::Collection<Organization>] the organizations collection
@example fetch the current member's boards
  Tacokit.organizations #=> Tacokit::Collection<Organization>
@example fetch the current member's closed organizations only
  Tacokit.organizations(filter: "closed") #=> Tacokit::Collection<Organization>

@overload organizations(options = {})

Retrieve current member's organizations
@param options [Hash] the options to fetch the organizations with
@return [Tacokit::Collection<Organization>] the organizations collection
@example fetch the organizations for the member named 'tacokit'
  Tacokit.organizations("tacokit") #=> Tacokit::Collection<Organization>

@see developers.trello.com/advanced-reference/member#get-1-members-idmember-or-username-organizations

# File lib/tacokit/client/members.rb, line 131
def organizations(username = "me", options = {})
  username, options = extract_member_args(username, options)
  get member_path(username, "organizations"), options
end
tokens(username = "me", options = {}) click to toggle source

@overload tokens(username = “me”, options = {})

Retrieve a member's tokens
@param username [String, Tacokit::Resource<Member>] the username or member resource
@param options [Hash] the options to fetch the tokens with
@return [Tacokit::Collection<Token>] the tokens collection
@example fetch the current member's boards
  Tacokit.tokens #=> Tacokit::Collection<Token>
@example fetch the current member's closed tokens only
  Tacokit.tokens(filter: "closed") #=> Tacokit::Collection<Token>

@overload tokens(options = {})

Retrieve current member's tokens
@param options [Hash] the options to fetch the tokens with
@return [Tacokit::Collection<Token>] the tokens collection
@example fetch the tokens for the member named 'tacokit'
  Tacokit.tokens("tacokit") #=> Tacokit::Collection<Token>

@see developers.trello.com/advanced-reference/member#get-1-members-idmember-or-username-organizations

# File lib/tacokit/client/members.rb, line 152
def tokens(username = "me", options = {})
  username, options = extract_member_args(username, options)
  get member_path(username, "tokens"), options
end
update_member(username = "me", options = {}) click to toggle source

Update a member @param username [String, Tacokit::Resource<Member>] the username or member resource @param options [Hash] the attributes to update on the list @example update current member's name

Tacokit.update_member(name: "Moonriver") #=> Tacokit::Resource<Member>

@see developers.trello.com/advanced-reference/member#put-1-members-idmember-or-username

# File lib/tacokit/client/members.rb, line 163
def update_member(username = "me", options = {})
  username, options = extract_member_args(username, options)
  put member_path(username), options
end

Private Instance Methods

extract_member_args(username, options) click to toggle source
# File lib/tacokit/client/members.rb, line 179
def extract_member_args(username, options)
  options, username = username, "me" if username.is_a?(Hash)
  [username, options]
end
member_path(member_id, *paths) click to toggle source
# File lib/tacokit/client/members.rb, line 175
def member_path(member_id, *paths)
  resource_path("members", member_id, *paths)
end
member_resource(username, resource, *paths) click to toggle source
# File lib/tacokit/client/members.rb, line 170
def member_resource(username, resource, *paths)
  paths, options = extract_options(camp(resource), *paths)
  get(member_path(username, *paths), options)
end