Sha256: b9755bfda3dabfe743261a7626c0c98dedb0f433be690c0febc2a30b8d794855

Contents?: true

Size: 1.07 KB

Versions: 19

Compression:

Stored size: 1.07 KB

Contents

# Copyright (C) 2008-2011 AMEE UK Ltd. - http://www.amee.com
# Released as Open Source Software under the BSD 3-Clause license. See LICENSE.txt for details.

dir = File.dirname(__FILE__) + '/../lib'
$LOAD_PATH << dir unless $LOAD_PATH.include?(dir)

#require 'rubygems'
require 'amee'
require 'optparse'

# Command-line options - get username, password, and server
options = {}
OptionParser.new do |opts|
  opts.on("-u", "--username USERNAME", "AMEE username") do |u|
    options[:username] = u
  end  
  opts.on("-p", "--password PASSWORD", "AMEE password") do |p|
    options[:password] = p
  end
  opts.on("-s", "--server SERVER", "AMEE server") do |s|
    options[:server] = s
  end
end.parse!

# Connect
connection = AMEE::Connection.new(options[:server], options[:username], options[:password])

# Create a new profile item
category = AMEE::Profile::Category.get(connection, ARGV[0])
puts "loaded category #{category.name}"
item = AMEE::Profile::Item.create(category, ARGV[1])
if item
  puts "created item in #{category.name} OK"
else
  puts "error creating item in #{category.name}"
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
amee-4.4.0 examples/create_profile_item.rb
amee-4.3.2 examples/create_profile_item.rb
amee-4.3.1 examples/create_profile_item.rb
amee-4.3.0 examples/create_profile_item.rb
amee-4.2.0 examples/create_profile_item.rb
amee-3.2.1 examples/create_profile_item.rb
amee-3.2.0 examples/create_profile_item.rb
amee-4.1.7 examples/create_profile_item.rb
amee-4.1.6 examples/create_profile_item.rb
amee-4.1.5 examples/create_profile_item.rb
amee-4.1.4 examples/create_profile_item.rb
amee-4.1.3 examples/create_profile_item.rb
amee-3.1.2 examples/create_profile_item.rb
amee-3.1.1 examples/create_profile_item.rb
amee-4.1.2 examples/create_profile_item.rb
amee-4.1.1 examples/create_profile_item.rb
amee-4.1.0 examples/create_profile_item.rb
amee-4.0.0 examples/create_profile_item.rb
amee-3.0.1 examples/create_profile_item.rb