Class: Dune::Api::ProjectSerializer
- Inherits:
-
ActiveModel::Serializer
- Object
- ActiveModel::Serializer
- Dune::Api::ProjectSerializer
- Defined in:
- app/serializers/dune/api/project_serializer.rb
Instance Method Summary collapse
- #channel_id ⇒ Object
- #created_at ⇒ Object
- #expires_at ⇒ Object
- #html_url ⇒ Object
- #online_date ⇒ Object
- #rights ⇒ Object
- #url ⇒ Object
Instance Method Details
#channel_id ⇒ Object
23 24 25 |
# File 'app/serializers/dune/api/project_serializer.rb', line 23 def channel_id object.last_channel.try(:id) end |
#created_at ⇒ Object
5 6 7 |
# File 'app/serializers/dune/api/project_serializer.rb', line 5 def created_at object.created_at.to_datetime.utc.rfc3339 end |
#expires_at ⇒ Object
9 10 11 12 13 14 |
# File 'app/serializers/dune/api/project_serializer.rb', line 9 def expires_at value = object.expires_at if value value.to_datetime.utc.rfc3339 end end |
#html_url ⇒ Object
41 42 43 |
# File 'app/serializers/dune/api/project_serializer.rb', line 41 def html_url main_app.project_url(object) end |
#online_date ⇒ Object
16 17 18 19 20 21 |
# File 'app/serializers/dune/api/project_serializer.rb', line 16 def online_date value = object.online_date if value value.to_datetime.utc.rfc3339 end end |
#rights ⇒ Object
27 28 29 30 31 32 33 34 35 |
# File 'app/serializers/dune/api/project_serializer.rb', line 27 def rights { can_approve: object.can_approve?, can_launch: object.can_launch?, can_reject: object.can_reject?, can_push_to_draft: object.can_push_to_draft?, can_push_to_trash: object.can_push_to_trash? } end |
#url ⇒ Object
37 38 39 |
# File 'app/serializers/dune/api/project_serializer.rb', line 37 def url dune_api.project_url(object.id) end |