class TeamsIncomingClients::DayOfWeekClient

Public Instance Methods

post(text, week_of_days) click to toggle source

指定した曜日であればメッセージを送信する @return [PostResult] @param [String] text 送信するメッセージ @param [Array, String, Symbol] week_of_days 送信したいときの曜日の英語文字列。配列で複数条件を渡すことも可能 @example client.post(“hello world”, :monday)

# File lib/teams_incoming_clients/models/day_of_week_client.rb, line 9
def post(text, week_of_days)
  if post_week_of_day?(week_of_days)
    post_message(text)
  else
    PostResult.new(false, :not_post, "Today is not #{week_of_days}")
  end
end

Private Instance Methods

post_week_of_day?(week_of_days) click to toggle source
# File lib/teams_incoming_clients/models/day_of_week_client.rb, line 19
def post_week_of_day?(week_of_days)
  if week_of_days.is_a?(Array)
    week_of_days.one? {|week_of_day| today.week_of_day?(week_of_day) }
  else
    today.week_of_day?(week_of_days)
  end
end