Floppy-amee 0.4.21 → 0.4.22
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/amee/profile_item.rb +10 -4
- data/lib/amee/version.rb +1 -1
- metadata +2 -2
data/lib/amee/profile_item.rb
CHANGED
@@ -78,9 +78,7 @@ module AMEE
|
|
78
78
|
raise AMEE::BadData.new("Couldn't load ProfileItem from XML data. Check that your URL is correct.")
|
79
79
|
end
|
80
80
|
|
81
|
-
def self.
|
82
|
-
# Load data from path
|
83
|
-
response = connection.get(path, :profileDate => for_date.strftime("%Y%m"))
|
81
|
+
def self.parse(connection, response)
|
84
82
|
# Parse data from response
|
85
83
|
if response.is_json?
|
86
84
|
cat = Item.from_json(response)
|
@@ -91,6 +89,12 @@ module AMEE
|
|
91
89
|
cat.connection = connection
|
92
90
|
# Done
|
93
91
|
return cat
|
92
|
+
end
|
93
|
+
|
94
|
+
def self.get(connection, path, for_date = Date.today)
|
95
|
+
# Load data from path
|
96
|
+
response = connection.get(path, :profileDate => for_date.strftime("%Y%m"))
|
97
|
+
return Item.parse(connection, response)
|
94
98
|
rescue
|
95
99
|
raise AMEE::BadData.new("Couldn't load ProfileItem. Check that your URL is correct.")
|
96
100
|
end
|
@@ -98,13 +102,15 @@ module AMEE
|
|
98
102
|
def self.create(profile, data_item_uid, options = {})
|
99
103
|
# Send data to path
|
100
104
|
options.merge! :dataItemUid => data_item_uid
|
101
|
-
profile.connection.post(profile.full_path, options)
|
105
|
+
response = profile.connection.post(profile.full_path, options)
|
106
|
+
return Item.parse(profile.connection, response)
|
102
107
|
rescue
|
103
108
|
raise AMEE::BadData.new("Couldn't create ProfileItem. Check that your information is correct.")
|
104
109
|
end
|
105
110
|
|
106
111
|
def update(options = {})
|
107
112
|
connection.put(full_path, options)
|
113
|
+
return Item.parse(connection, response)
|
108
114
|
rescue
|
109
115
|
raise AMEE::BadData.new("Couldn't update ProfileItem. Check that your information is correct.")
|
110
116
|
end
|
data/lib/amee/version.rb
CHANGED
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.22
|
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-11-
|
12
|
+
date: 2008-11-20 00:00:00 -08:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|