Sha256: 6bc9acf93e22b1088c681c18599eb528932c6c8d5f5d28b9cadc6576e2122d5c

Contents?: true

Size: 979 Bytes

Versions: 22

Compression:

Stored size: 979 Bytes

Contents

#
# Provides a base template for interface and behavior of contact importers

module Blackbook::Importer
  class Base
    attr_accessor :options

    ##
    # Should return true or false/nil depending on whether the +options+ given 
    # can be handled by this importer

    def =~( options ); end # stub

    ##
    # Does the work of extracting contacts. Returns an Array of Arrays 
    # containing the name and email as the first and second elements. Of 
    # course, you can override this behavior to meet the needs of a 
    # particular service.

    def fetch_contacts!; end # stub

    ##
    # Imports the contacts using the given +options+. Returns an array of 
    # hashes in the internal format (a hash with at least :name and :email 
    # values).

    def import(options = {}) 
      self.options = options
      fetch_contacts!
    end

    ##
    # Name of the importer service.

    def service_name
      self.class.name.split("::").last
    end
  end
end

Version data entries

22 entries across 22 versions & 5 rubygems

Version Path
alexjp-blackbook_csv-1.0.5 lib/blackbook/importer/base.rb
alexjp-blackbook_csv-3.0.1 lib/blackbook/importer/base.rb
alexjp-blackbook_csv-3.0.2 lib/blackbook/importer/base.rb
bcardarella-blackbook-1.0.10 lib/blackbook/importer/base.rb
bcardarella-blackbook-1.0.11 lib/blackbook/importer/base.rb
bcardarella-blackbook-1.0.7 lib/blackbook/importer/base.rb
bcardarella-blackbook-1.0.8 lib/blackbook/importer/base.rb
bcardarella-blackbook-1.0.9 lib/blackbook/importer/base.rb
briancollins-blackbook-1.0.15 lib/blackbook/importer/base.rb
rakutenusa-blackbook-1.0.12 lib/blackbook/importer/base.rb
rakutenusa-blackbook-1.0.13 lib/blackbook/importer/base.rb
rakutenusa-blackbook-1.0.14 lib/blackbook/importer/base.rb
rakutenusa-blackbook-1.0.15 lib/blackbook/importer/base.rb
rakutenusa-blackbook-1.0.16 lib/blackbook/importer/base.rb
rakutenusa-blackbook-1.0.17 lib/blackbook/importer/base.rb
rakutenusa-blackbook-1.0.18 lib/blackbook/importer/base.rb
rakutenusa-blackbook-1.0.19 lib/blackbook/importer/base.rb
blackbook-1.0.0 lib/blackbook/importer/base.rb
blackbook-1.0.2 lib/blackbook/importer/base.rb
blackbook-1.0.1 lib/blackbook/importer/base.rb