Sha256: fbcdedb5e7f37c8a621659b7debaa199de2095e7df35b9e9b6e2df9455169d41

Contents?: true

Size: 762 Bytes

Versions: 5

Compression:

Stored size: 762 Bytes

Contents

module Tr3llo
  module API
    module User
      extend self

      def find(user_id)
        client = Application.fetch_client!()
        req_path = Utils.build_req_path("/members/#{user_id}")

        make_struct(client.get(req_path, {}))
      end

      def find_all_by_board(board_id)
        client = Application.fetch_client!()
        req_path = Utils.build_req_path("/board/#{board_id}/members")

        client
          .get(req_path, {})
          .map { |user_payload| make_struct(user_payload) }
      end

      private

      def make_struct(payload)
        id, username = payload.fetch_values("id", "username")
        shortcut = Entities.make_shortcut(:user, id)

        Entities::User.new(id, shortcut, username)
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
3llo-1.3.1 lib/3llo/api/user.rb
3llo-1.3.1.pre.rc.0 lib/3llo/api/user.rb
3llo-1.2.0 lib/3llo/api/user.rb
3llo-1.1.0 lib/3llo/api/user.rb
3llo-1.0.0 lib/3llo/api/user.rb