Skip to content

Commit

Permalink
Base64 support
Browse files Browse the repository at this point in the history
Added Base64 encode/decode calls to Parse::Bytes
  • Loading branch information
aalpern committed Jan 27, 2012
1 parent 4d5adb1 commit e404689
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/parse/datatypes.rb
@@ -1,3 +1,5 @@
require 'base64'

module Parse

# Pointer
Expand Down Expand Up @@ -58,15 +60,13 @@ class Bytes

def initialize(data)
bytes = data["base64"]
# TODO - decode base64
value = []
value = Base64.decode(bytes)
end

def to_json(*a)
{
Protocol::KEY_TYPE => Protocol::TYPE_BYTES,
# TODO - encode base64
"base64" => ""
"base64" => Base64.encode(@value)
}.to_json(*a)
end
end
Expand Down

0 comments on commit e404689

Please sign in to comment.