mapsqueak 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/mapsqueak.rb +12 -5
  2. metadata +2 -2
data/lib/mapsqueak.rb CHANGED
@@ -121,9 +121,10 @@ class MapSqueakSession
121
121
  unless [:json, :xml].include?(format)
122
122
  $stderr.puts "Error: must be in json or xml"
123
123
  end
124
-
125
- squeak_string = `curl #{self.host}/squeaks.#{format.to_s}?num_squeaks=#{max}&center_latitude=#{center_latitude}&center_longitude=#{center_longitude}`
126
124
 
125
+ squeak_string = `curl \'#{self.host}/squeaks.#{format.to_s}?num_squeaks=#{max}&center_latitude=#{center_latitude}&center_longitude=#{center_longitude}\'`
126
+
127
+ puts squeak_string
127
128
  return squeak_str_to_objects(squeak_string,format)
128
129
  end
129
130
 
@@ -141,7 +142,7 @@ class MapSqueakSession
141
142
  #
142
143
  def edit_squeak(squeak, update_hash)
143
144
  squeak.merge!(update_hash)
144
- "curl --request PUT --data #{squeak.to_json} #{self.host}/squeaks/#{squeak.id}.json -H \"Content-Type: application/json\""
145
+ "curl --request PUT --data \'#{squeak.to_json}\' #{self.host}/squeaks/#{squeak.id}.json -H \"Content-Type: application/json\""
145
146
  end
146
147
 
147
148
  :private
@@ -150,10 +151,11 @@ class MapSqueakSession
150
151
  case format
151
152
  when :xml
152
153
  doc = Document.new(squeak_string)
153
- doc.elements.each('squeaks/') {|el| squeaks << ClientSqueak.new(el.to_s)}
154
+ doc.elements.each('squeaks/squeak') {|el| squeaks << ClientSqueak.new(el.to_s)}
154
155
  when :json
155
156
  obj = JSON.parse(squeak_string)
156
- obj['squeaks'].each {|s| squeaks << ClientSqueak.new(s) }
157
+ # Note that gmaps4rails makes the json have a 'description' as opposed to 'text'
158
+ obj.each {|s| puts s; squeaks << ClientSqueak.new(s) }
157
159
  end
158
160
 
159
161
  return squeaks
@@ -165,6 +167,7 @@ class ClientSqueak
165
167
  include XmlHelpers
166
168
 
167
169
  attr_accessor :latitude, :longitude, :text, :duration, :expires, :username, :id, :time_utc,:expires,:created_at,:updated_at,:user_email, :gmaps
170
+
168
171
 
169
172
  # Initialize a new squeak which must be in an allowable format
170
173
  # Must set: latitude, longitude, text, and duration
@@ -311,5 +314,9 @@ class ClientSqueak
311
314
  self.to_hash.to_s
312
315
  end
313
316
 
317
+ # Note that gmaps4rails makes the json have a 'description' as opposed to 'text'
318
+ alias :description :text
319
+ alias :description= :text=
320
+
314
321
  end
315
322
 
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: mapsqueak
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 0.0.2
5
+ version: 0.0.3
6
6
  platform: ruby
7
7
  authors:
8
8
  - Ethan Stryker
@@ -10,7 +10,7 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2011-12-07 00:00:00 +00:00
13
+ date: 2011-12-17 00:00:00 +00:00
14
14
  default_executable:
15
15
  dependencies: []
16
16