Class: Graybook::Importer::Base
Direct Known Subclasses
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
Instance Method Summary collapse
-
#=~(options) ⇒ Object
Should return true or false/nil depending on whether the
options
given can be handled by this importer. -
#fetch_contacts! ⇒ Object
Does the work of extracting contacts.
-
#import(options = {}) ⇒ Object
Imports the contacts using the given
options
. -
#service_name ⇒ Object
Name of the importer service.
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
6 7 8 |
# File 'lib/graybook/importer/base.rb', line 6 def @options end |
Instance Method Details
#=~(options) ⇒ Object
Should return true or false/nil depending on whether the options
given can be handled by this importer
12 |
# File 'lib/graybook/importer/base.rb', line 12 def =~( ); end |
#fetch_contacts! ⇒ Object
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.
20 |
# File 'lib/graybook/importer/base.rb', line 20 def fetch_contacts!; end |
#import(options = {}) ⇒ Object
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).
27 28 29 30 |
# File 'lib/graybook/importer/base.rb', line 27 def import( = {}) self. = fetch_contacts! end |
#service_name ⇒ Object
Name of the importer service.
35 36 37 |
# File 'lib/graybook/importer/base.rb', line 35 def service_name self.class.name.split("::").last end |