Sha256: 580d73c339d3d720921c600dd25adef06bb1d640366caebc5f344601768e5f04

Contents?: true

Size: 731 Bytes

Versions: 4

Compression:

Stored size: 731 Bytes

Contents

module TrelloCli
  module Requests
    class Members

      include Shared

      def initialize(board_id)
        connect_to_trello

        @board_id = board_id
      end

      def member_exists_in_board?(member_username)
        !!find_member_by_username_in_board(member_username)
      end

      def find_member_by_username_in_board(member_username)
        members.each do |m|
          return m if m.attributes[:username] == member_username
        end

        false
      end

      private

      def member_id?(name)
        Trello::Member.find(name)
      end

      def members
        @members ||= board.members
      end

      def board
        @board ||= Trello::Board.find @board_id
      end

    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
trello_cli-0.5.0 lib/trello_cli/requests/members.rb
trello_cli-0.4.1 lib/trello_cli/requests/members.rb
trello_cli-0.4.0 lib/trello_cli/requests/members.rb
trello_cli-0.3.0 lib/trello_cli/requests/members.rb