Sha256: 3fd16da131db06245cc769c82b89507e59f2e10676c7a970d328a60e37078c35

Contents?: true

Size: 756 Bytes

Versions: 1

Compression:

Stored size: 756 Bytes

Contents

# encoding: utf-8

module Nimbu
  module Endpoints
    class Sites < Endpoint

      def list(*args)
        require_authentication
        arguments(args)

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

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

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


      private

      def require_authentication
        raise ArgumentError, 'You need to be authentication to access the sites' unless authenticated?
      end

    end # Authorizations
  end # Endpoints
end # Nimbu

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nimbu-api-0.0.1 lib/nimbu-api/endpoints/sites.rb