lib/event.rb in inbox-0.11.0 vs lib/event.rb in inbox-0.12.0

- old
+ new

@@ -7,8 +7,24 @@ parameter :description parameter :location parameter :read_only parameter :participants parameter :when + parameter :calendar_id + parameter :namespace_id + def as_json(options = {}) + hash = super(options) + + # Delete nil values from the hash + hash.delete_if { |key, value| value.nil? } + + # The API doesn't like to receive: "object": "timespan" in the when block. + if hash.has_key?('when') and hash['when'].has_key?('object') + hash['when'].delete('object') + end + + return hash + end + end -end \ No newline at end of file +end