Floppy-amee 0.4.9 → 0.4.10

Sign up to get free protection for your applications and to get access to all the features.
data/README CHANGED
@@ -20,13 +20,24 @@ Homepage: http://github.com/Floppy/amee-ruby
20
20
 
21
21
  Currently, you can read DataCategories, DataItems and DataItemValues. See
22
22
  examples/view_data_*.rb for simple usage examples. You can also get the list
23
- of available Profiles and create new ones. See examples/list_profiles.rb and
24
- examples/create_profile.rb for details. You can also load ProfileCategories,
25
- and load and create ProfileItems.
23
+ of available Profiles, and create and delete them. See examples/list_profiles.rb
24
+ and examples/create_profile.rb for details. You can also load ProfileCategories,
25
+ and load, create and update ProfileItems.
26
26
 
27
27
  The gem will use the AMEE JSON API if the JSON gem is installed on the local
28
28
  system. Otherwise the XML API will be used.
29
29
 
30
+ == SUPPORT
31
+ Create Read Update Delete
32
+ DataCategories N Y N N
33
+ DataItems N Y N N
34
+ DataItemValues N Y N Y
35
+ Profile List - Y - -
36
+ Profiles Y - - Y
37
+ ProfileCategories - Y - -
38
+ - drilldown - Y - -
39
+ ProfileItems Y Y Y Y
40
+
30
41
  == INTERACTIVE SHELL
31
42
 
32
43
  You can use the 'ameesh' app to interactively explore the AMEE data area. Run
@@ -66,6 +66,13 @@ module AMEE
66
66
  do_request(put)
67
67
  end
68
68
 
69
+ def delete(path)
70
+ # Create DELETE request
71
+ delete = Net::HTTP::Delete.new(path)
72
+ # Send request
73
+ do_request(delete)
74
+ end
75
+
69
76
  def authenticate
70
77
  unless can_authenticate?
71
78
  raise AMEE::AuthRequired.new("Authentication required. Please provide your username and password.")
data/lib/amee/profile.rb CHANGED
@@ -85,10 +85,10 @@ module AMEE
85
85
  raise AMEE::BadData.new("Couldn't create Profile.")
86
86
  end
87
87
 
88
- # def delete
89
- # # Create new profile
90
- # response = connection.delete(full_path)
91
- # end
88
+ def self.delete(connection, uid)
89
+ # Delete profile
90
+ connection.delete("/profiles/#{uid}")
91
+ end
92
92
 
93
93
  end
94
94
  end
@@ -99,6 +99,17 @@ module AMEE
99
99
  raise AMEE::BadData.new("Couldn't create ProfileItem. Check that your information is correct.")
100
100
  end
101
101
 
102
+ def update(options = {})
103
+ connection.put(full_path, options)
104
+ rescue
105
+ raise AMEE::BadData.new("Couldn't update ProfileItem. Check that your information is correct.")
106
+ end
107
+
108
+ def value(name_or_path)
109
+ val = values.find{ |x| x[:name] == name_or_path || x[:path] == name_or_path}
110
+ val ? val[:value] : nil
111
+ end
112
+
102
113
  end
103
114
  end
104
115
  end
data/lib/amee/version.rb CHANGED
@@ -3,7 +3,7 @@ module AMEE
3
3
  module VERSION #:nodoc:
4
4
  MAJOR = 0
5
5
  MINOR = 4
6
- TINY = 9
6
+ TINY = 10
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
9
9
 
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.9
4
+ version: 0.4.10
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-24 00:00:00 -07:00
12
+ date: 2008-10-01 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies: []
15
15