lib/eventful/api.rb
def call(method, params = {})
      # Use available auth tokens
      params.merge! @authentication if @authentication

      response = Net::HTTP.start(@server, @port) do |connection|
        if @http_user and @http_password then
          connection.post(
            "#{@root}#{method}",
            prepare_post(params),
            "Content-type" => "multipart/form-data; boundary=#{BOUNDARY} ",
            "Authorization" => Base64.encode64("#{@http_user}:#{@http_password}"))
        else
          connection.post(
            "#{@root}#{method}",
            prepare_post(params),
            "Content-type" => "multipart/form-data; boundary=#{BOUNDARY} ")
        end
      end

      # Raise an exception if we didn't get a 2xx response code
      response.value

      yaml = YAML::load response.body

      # Raise an error if we got an API error
      raise APIError.new(yaml['error']) if yaml['error']

      return yaml
    end
# Calls an API method with the given parameters, and returns the reply as
# a hash. Please see the Eventful API documentation (http://api.eventful.com/docs)
# for information about methods and their parameters.
#
# ==== Example
#
#  event = eventful.call 'events/get',
#                        :id => 'E0-001-001042544-7'
#
Calls an API method with the given parameters, and returns the reply as
a hash. Please see the Eventful API documentation
for information about methods and their parameters.

Example


Calls an API method with the given parameters and returns the reply as a hash . Please see the Eventful API documentation for information about methods and their parameters . Example
def call(method, params = {})
      params.merge! @authentication if @authentication
      response = Net::HTTP.start(@server, @port) do |connection|
        if @http_user and @http_password then
          connection.post(
            "#{@root}#{method}",
            prepare_post(params),
            "Content-type" => "multipart/form-data; boundary=#{BOUNDARY} ",
            "Authorization" => Base64.encode64("#{@http_user}:#{@http_password}"))
        else
          connection.post(
            "#{@root}#{method}",
            prepare_post(params),
            "Content-type" => "multipart/form-data; boundary=#{BOUNDARY} ")
        end
      end
      response.value
      yaml = YAML::load response.body
      raise APIError.new(yaml['error']) if yaml['error']
      return yaml
    end
def call ( method , params = { } ) params . merge! @authentication if @authentication response = Net :: HTTP . start ( @server , @port ) do | connection | if @http_user and @http_password then connection . post ( "#{@root}#{method}" , prepare_post ( params ) , "Content-type" => "multipart/form-data; boundary=#{BOUNDARY} " , "Authorization" => Base64 . encode64 ( "#{@http_user}:#{@http_password}" ) ) else connection . post ( "#{@root}#{method}" , prepare_post ( params ) , "Content-type" => "multipart/form-data; boundary=#{BOUNDARY} " ) end end response . value yaml = YAML :: load response . body raise APIError . new ( yaml [ 'error' ] ) if yaml [ 'error' ] return yaml end
Calls an API method with the given parameters, and returns the reply as
a hash.
Calls an API method with the given parameters and returns the reply as a hash .
# Use available auth tokens # Raise an exception if we didn't get a 2xx response code # Raise an error if we got an API error
method
params