Sha256: 4c995a7e18815c4a0228b3a68a055c241bff1dad93218dde962bf90f690535f9

Contents?: true

Size: 969 Bytes

Versions: 7

Compression:

Stored size: 969 Bytes

Contents

$:.unshift(File.expand_path(File.join(File.dirname(__FILE__),"..", "lib")))
require 'ctm'
access_token = CTM::Auth.authenticate(ENV['CTM_TOKEN'], ENV['CTM_SECRET'])
account = access_token.accounts.first

# find user by email
users = account.users.find(:email => "todd@calltrackingmetrics.com")
users.each do|user|
  puts "#{user.id}: #{user.name} #{user.email} -> #{user.role}"
end

# find by last name
users = account.users.find(:last_name => "fisher")
users.each do|user|
  puts "#{user.id}: #{user.name} #{user.email} -> #{user.role}"
end

# add a new user
user = account.users.create(:email => "foo@bar11#{Time.now.to_i}.com",
                            :first_name => "Me",
                            :last_name => "You",
                            :password => "foobar1234",
                            :role => "call_manager")
# update user
user.first_name = "No"
user.last_name = "Yes"
user.role = "admin"
user.save

# remove user from account
user.release!

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
ctm-0.5.4 examples/manage_users.rb
ctm-0.5.3 examples/manage_users.rb
ctm-0.5.1 examples/manage_users.rb
ctm-0.5.0 examples/manage_users.rb
ctm-0.4.4 examples/manage_users.rb
ctm-0.4.2 examples/manage_users.rb
ctm-0.0.1 examples/manage_users.rb