Class: ContextIO

Inherits:
Object
  • Object
show all
Defined in:
lib/contextio.rb,
lib/contextio/api.rb,
lib/contextio/file.rb,
lib/contextio/folder.rb,
lib/contextio/source.rb,
lib/contextio/thread.rb,
lib/contextio/account.rb,
lib/contextio/contact.rb,
lib/contextio/message.rb,
lib/contextio/version.rb,
lib/contextio/webhook.rb,
lib/contextio/body_part.rb,
lib/contextio/api/resource.rb,
lib/contextio/connect_token.rb,
lib/contextio/email_address.rb,
lib/contextio/email_settings.rb,
lib/contextio/oauth_provider.rb,
lib/contextio/api/url_builder.rb,
lib/contextio/file_collection.rb,
lib/contextio/folder_sync_data.rb,
lib/contextio/source_sync_data.rb,
lib/contextio/account_sync_data.rb,
lib/contextio/folder_collection.rb,
lib/contextio/source_collection.rb,
lib/contextio/thread_collection.rb,
lib/contextio/account_collection.rb,
lib/contextio/contact_collection.rb,
lib/contextio/message_collection.rb,
lib/contextio/webhook_collection.rb,
lib/contextio/body_part_collection.rb,
lib/contextio/api/association_helpers.rb,
lib/contextio/api/resource_collection.rb,
lib/contextio/connect_token_collection.rb,
lib/contextio/email_address_collection.rb,
lib/contextio/oauth_provider_collection.rb

Overview

Provides an object-oriented interface for the Context.IO API.

To use it, you have to sign up for an account.

Once you have an account, you can create a new ContextIO object and interact with the API using the methods on that object as a starting point.

Defined Under Namespace

Classes: API, Account, AccountCollection, AccountSyncData, BodyPart, BodyPartCollection, ConnectToken, ConnectTokenCollection, Contact, ContactCollection, EmailAddress, EmailAddressCollection, EmailSettings, File, FileCollection, Folder, FolderCollection, FolderSyncData, Message, MessageCollection, OAuthProvider, OAuthProviderCollection, Source, SourceCollection, SourceSyncData, Thread, ThreadCollection, Webhook, WebhookCollection

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key, secret, opts = {}) ⇒ ContextIO

Creates a new ContextIO instance and makes a new handle for the API. This is your entry point to your Context.IO account. For a web app, you probably want to instantiate this in some kind of initializer and keep it around for the life of the process.

Parameters:

  • key (String)

    Your OAuth consumer key for your Context.IO account

  • secret (String)

    Your OAuth consumer secret for your Context.IO account

  • opts (Hash) (defaults to: {})

    Optional options for OAuth connections. ie. :timeout and :open_timeout are supported



21
22
23
# File 'lib/contextio.rb', line 21

def initialize(key, secret, opts={})
  @api = API.new(key, secret, opts)
end

Class Method Details

.versionString

The gem version.

Returns:

  • (String)

    The gem version.



8
9
10
# File 'lib/contextio/version.rb', line 8

def self.version
  VERSION
end

Instance Method Details

#accountsAccountCollection

Your entry point for dealing with accounts.

Returns:

  • (AccountCollection)

    Allows you to work with the email accounts for your account as a group.



45
46
47
# File 'lib/contextio.rb', line 45

def accounts
  AccountCollection.new(api)
end

#connect_tokensConnectTokenCollection

Your entry point for dealing with connect tokens.

Returns:



37
38
39
# File 'lib/contextio.rb', line 37

def connect_tokens
  ConnectTokenCollection.new(api)
end

#email_settings_for(email_address, source_type = 'IMAP') ⇒ EmailSettings

Discover the IMAP settings for an email account.

Parameters:

  • email_address (String)

    The email address in question.

  • source_type (String) (defaults to: 'IMAP')

    The only source type currently supported by the API is 'IMAP'.

Returns:

  • (EmailSettings)

    Allows you to inspec the settings for an account's IMAP server.



57
58
59
# File 'lib/contextio.rb', line 57

def email_settings_for(email_address, source_type = 'IMAP')
  EmailSettings.new(api, email_address, source_type)
end

#oauth_providersOAuthProviderCollection

Your entry point for dealing with oauth providers.

Returns:



29
30
31
# File 'lib/contextio.rb', line 29

def oauth_providers
  OAuthProviderCollection.new(api)
end