Sha256: 2ae7253b9d335e0f8774f2862155d51cc783d5cb7a3880e44964e8d653479c36

Contents?: true

Size: 649 Bytes

Versions: 6

Compression:

Stored size: 649 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

6 entries across 6 versions & 1 rubygems

Version Path
animoto-0.0.0.alpha9 ./lib/animoto/standard_envelope.rb
animoto-0.0.0.alpha8 ./lib/animoto/standard_envelope.rb
animoto-0.0.0.alpha7 ./lib/animoto/standard_envelope.rb
animoto-0.0.0.alpha6 ./lib/animoto/standard_envelope.rb
animoto-0.0.0.alpha5 ./lib/animoto/standard_envelope.rb
animoto-0.0.0.alpha4 ./lib/animoto/standard_envelope.rb