Module: RIQ

Defined in:
lib/riq.rb,
lib/riq/list.rb,
lib/riq/user.rb,
lib/riq/error.rb,
lib/riq/event.rb,
lib/riq/client.rb,
lib/riq/account.rb,
lib/riq/contact.rb,
lib/riq/riq_obj.rb,
lib/riq/list_item.rb,
lib/riq/batch_manager.rb,
lib/riq/list_item_manager.rb,
lib/riq/account_properties.rb

Overview

The namespace from which all magic springs

Defined Under Namespace

Classes: Account, AccountProperties, BatchManager, Client, Contact, Event, HTTPError, List, ListItem, ListItemManager, NotFoundError, NotImplementedError, RIQError, RIQObject, User

Class Method Summary collapse

Class Method Details

.account(id = nil) ⇒ Account

Convenience method to create new Accounts

Parameters:

  • id (String, nil) (defaults to: nil)

    create a blank Account object or fetch an existing one by id.

Returns:



78
79
80
# File 'lib/riq/account.rb', line 78

def (id = nil)
  Account.new(id)
end

.account_propsObject



31
32
33
# File 'lib/riq/account_properties.rb', line 31

def 
  AccountProperties.new
end

.accounts(opts = {}) ⇒ BatchManager

Returns an iterator for all accounts

Returns:



129
130
131
# File 'lib/riq/batch_manager.rb', line 129

def accounts(opts = {})
  BatchManager.new(RIQ::Account, opts)
end

.clientClient

Always use RIQ.client to retrieve the client object.

Returns:

  • (Client)

    The client object

Raises:



126
127
128
129
# File 'lib/riq/client.rb', line 126

def client
  raise RIQError, 'Client not initialized' unless defined?(@@client)
  @@client
end

.contact(id = nil) ⇒ Contact

Convenience method to create new Contacts

Parameters:

  • id (String, nil) (defaults to: nil)

    create a blank Contact object or fetch an existing one by id.

Returns:



195
196
197
# File 'lib/riq/contact.rb', line 195

def contact(id = nil)
  Contact.new(id)
end

.contacts(opts = {}) ⇒ BatchManager

Returns an iterator for all contacts

Returns:



124
125
126
# File 'lib/riq/batch_manager.rb', line 124

def contacts(opts = {})
  BatchManager.new(RIQ::Contact, opts)
end

.event(obj = nil) ⇒ Event

Convenience method to create new Events

Parameters:

  • obj (Hash) (defaults to: nil)

    Info to parse into event

Returns:



69
70
71
# File 'lib/riq/event.rb', line 69

def event(obj = nil)
  Event.new(obj)
end

.init(key = nil, secret = nil) ⇒ RIQ

Returns The module, in case you want it.

Parameters:

  • key (String) (defaults to: nil)

    SalesforceIQ API key

  • secret (String) (defaults to: nil)

    SalesforceIQ API secret

Returns:

  • (RIQ)

    The module, in case you want it.



116
117
118
119
120
121
122
# File 'lib/riq/client.rb', line 116

def init(key = nil, secret = nil)
  key ||= ENV['RIQ_TEST_API_KEY']
  secret ||= ENV['RIQ_TEST_API_SECRET']

  @@client = Client.new(key, secret)
  self
end

.list(id = nil) ⇒ List

Convenience method to create new Lists

Parameters:

  • id (String, nil) (defaults to: nil)

    create a blank List object or fetch an existing one by id.

Returns:



85
86
87
# File 'lib/riq/list.rb', line 85

def list(id = nil)
  List.new(id)
end

.lists(opts = {}) ⇒ BatchManager

Returns an iterator for all lists

Returns:



119
120
121
# File 'lib/riq/batch_manager.rb', line 119

def lists(opts = {})
  BatchManager.new(RIQ::List, opts)
end

.user(id = nil) ⇒ User

Convenience method to create new Users

Parameters:

  • id (String, nil) (defaults to: nil)

    create a blank User object or fetch an existing one by id.

Returns:



48
49
50
# File 'lib/riq/user.rb', line 48

def user(id = nil)
  RIQ::User.new(id)
end