Sha256: b14bc756e5015c0bf62730b7a7e1fabdc9a17a3d4314a547d4c5a444b19f5ae7

Contents?: true

Size: 735 Bytes

Versions: 3

Compression:

Stored size: 735 Bytes

Contents

class UserSerializer < ActiveModel::Serializer
  def created_at
    object.created_at.to_datetime.utc.rfc3339
  end

  def name
    object.display_name
  end

  def image_url
    object.display_image
  end

  def total_contributed
    object.user_total ? object.user_total.sum : 0
  end

  def url
    dune_api.user_url(object.id)
  end

  def html_url
    main_app.user_url(object)
  end

  def manager
    (object.admin? || object.channel.present? || object.channels.any?)
  end

  attributes :id,
    :bio,
    :created_at,
    :email,
    :facebook_url,
    :linkedin_url,
    :other_url,
    :profile_type,
    :twitter_url,
    :name,
    :image_url,
    :total_contributed,
    :admin,
    :url,
    :html_url,
    :manager
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
dune-api-1.1.0 app/serializers/user_serializer.rb
dune-api-1.0.2 app/serializers/user_serializer.rb
dune-api-1.0.1 app/serializers/user_serializer.rb