Sha256: cac782831b0f7821ce44d98be30043fa28c22d8402464fcc412977f3157df8c2

Contents?: true

Size: 792 Bytes

Versions: 5

Compression:

Stored size: 792 Bytes

Contents

module UnfuddleMyEmail
  class Runner
    def initialize(configuration_path)
      @options = Configuration.new(configuration_path)
    end

    def run
      fetcher = Fetcher.new(@options.pop3_server, @options.pop3_port, @options.pop3_ssl, @options.pop3_username, @options.pop3_password, @options.pop3_delete)
      fetcher.each do |message|
        ticket = EmailTicket.new(message)
        p "Posting ticket: #{ticket.message.subject}"
        Poster::post(domain, url, @options.unfuddle_ssl, @options.unfuddle_username, @options.unfuddle_password, ticket.to_xml)
      end
    end

    private

    def domain
      "#{@options.unfuddle_subdomain}.unfuddle.com"
    end

    def url
      "#{@options.unfuddle_api_url}/projects/#{@options.unfuddle_project_id}/tickets"
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
unfuddle_my_email-0.2.2 lib/unfuddle_my_email/runner.rb
unfuddle_my_email-0.2.1 lib/unfuddle_my_email/runner.rb
unfuddle_my_email-0.2.0 lib/unfuddle_my_email/runner.rb
unfuddle_my_email-0.1.4 lib/unfuddle_my_email/runner.rb
unfuddle_my_email-0.1.3 lib/unfuddle_my_email/runner.rb