Sha256: 42de4b93c37fc47888af3c2f8bdd6eee54124106b6e7d13436507a99b56bc61e

Contents?: true

Size: 651 Bytes

Versions: 4

Compression:

Stored size: 651 Bytes

Contents

module Animoto
  module StandardEnvelope
    
    def self.included base
      base.class_eval {
        include Animoto::StandardEnvelope::InstanceMethods
        extend Animoto::StandardEnvelope::ClassMethods
      }
    end
    
    module InstanceMethods
      def unpack_standard_envelope body = {}
        self.class.unpack_standard_envelope body
      end
    end
    
    module ClassMethods
      protected
      def unpack_standard_envelope body = {}
        {
          :url => body['response']['payload'][payload_key]['links']['self'],
          :errors => body['response']['status']['errors'] || []
        }  
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
animoto-0.0.0.alpha3 ./lib/animoto/standard_envelope.rb
animoto-0.0.0.alpha2 ./lib/animoto/standard_envelope.rb
animoto-0.0.0.alpha1 ./lib/animoto/standard_envelope.rb
animoto-0.0.0.alpha0 ./lib/animoto/standard_envelope.rb