Sha256: 7e5f0fdaf9b915bb52b604f8cd9b9c2c33ff038b85cf5c8e8c43c348234a1871

Contents?: true

Size: 665 Bytes

Versions: 3

Compression:

Stored size: 665 Bytes

Contents

module Outpost
  module AssetHost
    module JoinModelJson
      def as_json(options={})
        @as_json ||= begin
          # grab asset as_json, merge in our values
          self.asset.as_json(options).merge!({
            "post_asset_id"   => self.id,
            "caption"         => self.caption,
            "ORDER"           => self.position,
            "credit"          => self.asset.owner
          })
        end
      end


      def simple_json
        @simple_json ||= {
          "id"          => self.asset_id.to_i,
          "caption"     => self.caption.to_s,
          "position"    => self.position.to_i
        }
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
outpost-asset_host-1.1.1 lib/outpost/asset_host/join_model_json.rb
outpost-asset_host-1.1.0 lib/outpost/asset_host/join_model_json.rb
outpost-asset_host-1.0.0 lib/outpost/asset_host/join_model_json.rb