Module: ActiveResource::Formats::AthenaFormat

Extended by:
AthenaFormat
Included in:
AthenaFormat
Defined in:
lib/athena_resource/formats/athena_format.rb

Instance Method Summary collapse

Instance Method Details

#decode(json) ⇒ Object



26
27
28
# File 'lib/athena_resource/formats/athena_format.rb', line 26

def decode(json)
  decode_athena(ActiveSupport::JSON.decode(json))
end

#encode(hash, options = {}) ⇒ Object



16
17
18
19
20
21
22
23
24
# File 'lib/athena_resource/formats/athena_format.rb', line 16

def encode(hash, options = {})
  rejections = options.delete :rejections || []
  hash = hash.reject { | k , v | rejections.include? k } unless rejections.nil?

  results = encode_athena(hash)
  results = ActiveSupport::JSON.encode(results, options) unless options.delete(:skip_serialization)

  results
end

#extensionObject



8
9
10
# File 'lib/athena_resource/formats/athena_format.rb', line 8

def extension
  "json"
end

#mime_typeObject



12
13
14
# File 'lib/athena_resource/formats/athena_format.rb', line 12

def mime_type
  "application/json"
end