Floppy-amee 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/examples/create_profile_item.rb +29 -0
- data/lib/amee.rb +1 -0
- data/lib/amee/profile_item.rb +15 -0
- metadata +4 -2
@@ -0,0 +1,29 @@
|
|
1
|
+
dir = File.dirname(__FILE__) + '/../lib'
|
2
|
+
$LOAD_PATH << dir unless $LOAD_PATH.include?(dir)
|
3
|
+
|
4
|
+
#require 'rubygems'
|
5
|
+
require 'amee'
|
6
|
+
require 'optparse'
|
7
|
+
|
8
|
+
# Command-line options - get username, password, and server
|
9
|
+
options = {}
|
10
|
+
OptionParser.new do |opts|
|
11
|
+
opts.on("-u", "--username USERNAME", "AMEE username") do |u|
|
12
|
+
options[:username] = u
|
13
|
+
end
|
14
|
+
opts.on("-p", "--password PASSWORD", "AMEE password") do |p|
|
15
|
+
options[:password] = p
|
16
|
+
end
|
17
|
+
opts.on("-s", "--server SERVER", "AMEE server") do |s|
|
18
|
+
options[:server] = s
|
19
|
+
end
|
20
|
+
end.parse!
|
21
|
+
|
22
|
+
# Connect
|
23
|
+
connection = AMEE::Connection.new(options[:server], options[:username], options[:password])
|
24
|
+
|
25
|
+
# Create a new profile item
|
26
|
+
category = AMEE::Profile::Category.get(connection, ARGV[0])
|
27
|
+
puts "loaded category #{category.name}"
|
28
|
+
AMEE::Profile::Item.create(category, ARGV[1])
|
29
|
+
puts "created item in #{category.name} OK"
|
data/lib/amee.rb
CHANGED
@@ -0,0 +1,15 @@
|
|
1
|
+
module AMEE
|
2
|
+
module Profile
|
3
|
+
class Item < AMEE::Profile::Object
|
4
|
+
|
5
|
+
def self.create(profile, data_item_uid, options = {})
|
6
|
+
# Send data to path
|
7
|
+
options.merge! :dataItemUid => data_item_uid
|
8
|
+
profile.connection.post(profile.full_path, options)
|
9
|
+
rescue
|
10
|
+
raise AMEE::BadData.new("Couldn't create ProfileItem. Check that your information is correct.")
|
11
|
+
end
|
12
|
+
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: Floppy-amee
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- James Smith
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-09-
|
12
|
+
date: 2008-09-04 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -31,6 +31,7 @@ files:
|
|
31
31
|
- lib/amee/profile.rb
|
32
32
|
- lib/amee/profile_object.rb
|
33
33
|
- lib/amee/profile_category.rb
|
34
|
+
- lib/amee/profile_item.rb
|
34
35
|
- lib/amee/version.rb
|
35
36
|
- lib/amee/data_category.rb
|
36
37
|
- lib/amee/data_item_value.rb
|
@@ -40,6 +41,7 @@ files:
|
|
40
41
|
- bin/ameesh
|
41
42
|
- examples/list_profiles.rb
|
42
43
|
- examples/create_profile.rb
|
44
|
+
- examples/create_profile_item.rb
|
43
45
|
- examples/view_data_category.rb
|
44
46
|
- examples/view_data_item.rb
|
45
47
|
- init.rb
|