Sha256: 6dcad01e3d2d49e0cdc692606296e6eef761ea6a74deaa4bc041722f19040f50

Contents?: true

Size: 936 Bytes

Versions: 52

Compression:

Stored size: 936 Bytes

Contents

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

52 entries across 52 versions & 2 rubygems

Version Path
Floppy-amee-0.4.26 examples/create_profile_item.rb
Floppy-amee-0.4.27 examples/create_profile_item.rb
Floppy-amee-0.4.28 examples/create_profile_item.rb
Floppy-amee-0.4.29 examples/create_profile_item.rb
Floppy-amee-0.4.30 examples/create_profile_item.rb
Floppy-amee-0.4.31 examples/create_profile_item.rb
Floppy-amee-0.4.32 examples/create_profile_item.rb
Floppy-amee-0.4.33 examples/create_profile_item.rb
Floppy-amee-2.0.0 examples/create_profile_item.rb
Floppy-amee-2.0.1 examples/create_profile_item.rb
Floppy-amee-2.0.10 examples/create_profile_item.rb
Floppy-amee-2.0.11 examples/create_profile_item.rb
Floppy-amee-2.0.12 examples/create_profile_item.rb
Floppy-amee-2.0.13 examples/create_profile_item.rb
Floppy-amee-2.0.14 examples/create_profile_item.rb
Floppy-amee-2.0.15 examples/create_profile_item.rb
Floppy-amee-2.0.16 examples/create_profile_item.rb
Floppy-amee-2.0.17 examples/create_profile_item.rb
Floppy-amee-2.0.18 examples/create_profile_item.rb
Floppy-amee-2.0.19 examples/create_profile_item.rb