Sha256: d1a0beab4e7f2d89b83403d9224b01f0334e24cd31b8e1ec467dd2eb3b4a2598
Contents?: true
Size: 690 Bytes
Versions: 10
Compression:
Stored size: 690 Bytes
Contents
# frozen_string_literal: true module Slack module Web module Api module Mixins module Ids private def id_for(key, name, prefix, enum_method, list_method, not_found_error) return { 'ok' => true, key.to_s => { 'id' => name } } unless name[0] == prefix public_send enum_method do |list| list.public_send(list_method).each do |li| return Slack::Messages::Message.new('ok' => true, key.to_s => { 'id' => li.id }) if li.name == name[1..-1] end end raise Slack::Web::Api::Errors::SlackError, not_found_error end end end end end end
Version data entries
10 entries across 10 versions & 1 rubygems