lib/troo/external/member.rb in troo-0.0.3 vs lib/troo/external/member.rb in troo-0.0.4

- old
+ new

@@ -1,8 +1,8 @@ module Troo module External - class Member + class Member < Resource class << self def fetch(external_id, options = {}) new(external_id, options).fetch_by_external_id.map do |resource| Troo::MemberPersistence.for(resource) end @@ -12,17 +12,10 @@ def initialize(external_id, options = {}) @external_id = external_id @options = options end - def fetch_by_external_id - case options.fetch(:mode) - when :board then board_mode - when :member then member_mode - end - end - private attr_reader :external_id def options defaults.merge!(@options) @@ -30,23 +23,23 @@ def defaults { mode: :board } end - def board_mode + def by_board_id Trello::Board.find(external_id).members - rescue Trello::InvalidAccessToken - raise Troo::InvalidAccessToken - rescue Trello::Error + end + + def by_list_id [] end - def member_mode - [Trello::Member.find(external_id)] - rescue Trello::InvalidAccessToken - raise Troo::InvalidAccessToken - rescue Trello::Error + def by_card_id [] + end + + def by_member_id + [Trello::Member.find(external_id)] end end end end