Sha256: 70730e9f0c61d596c94d79a4d7ed44b33421e65ee3dbc981c6355f2bd61456e5

Contents?: true

Size: 1.28 KB

Versions: 5

Compression:

Stored size: 1.28 KB

Contents

# encoding: utf-8


module Nimbu
  module Endpoints
    class Channels < Endpoint

      def entries(options={}, &block)
        Nimbu::Builder.new('Channels::Entries', current_options.merge(options), &block)
      end

      def list(*args)
        arguments(args)

        response = get_request("/channels", arguments.params)
        return response unless block_given?
        response.each { |el| yield el }
      end
      alias :all :list

      def first(*args)
        arguments(args)

        get_request("/channels", arguments.params.merge(limit: 1)).first
      end

      def get(*args)
        arguments(args, :required => [:channel_id])

        get_request("/channels/#{channel_id}", arguments.params)
      end
      alias :find :get

      def webhooks(*args)
        arguments(args, :required => [:channel_id])

        get_request("/channels/#{channel_id}/webhooks", arguments.params)
      end

      def add_webhook(*args)
        arguments(args, :required => [:channel_id])

        post_request("/channels/#{channel_id}/webhooks", arguments.params)
      end

      def poll_webhook(*args)
        arguments(args, :required => [:channel_id])

        post_request("/channels/#{channel_id}/webhooks/poll", arguments.params)
      end

    end # Authorizations
  end # Endpoints
end # Nimbu

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
nimbu-api-0.4.4 lib/nimbu-api/endpoints/channels.rb
nimbu-api-0.4.3 lib/nimbu-api/endpoints/channels.rb
nimbu-api-0.4.2 lib/nimbu-api/endpoints/channels.rb
nimbu-api-0.4.1 lib/nimbu-api/endpoints/channels.rb
nimbu-api-0.4.0 lib/nimbu-api/endpoints/channels.rb