user_application_presenter.rb 691 Bytes
Newer Older
1
class UserApplicationPresenter
augier's avatar
augier committed
2 3
  attr_reader :scopes

4 5 6 7 8 9 10 11 12 13 14
  def initialize(application, scopes, authorization_id=nil)
    @app = application
    @scopes = scopes
    @authorization_id = authorization_id
  end

  def id
    @authorization_id
  end

  def name
15
    @app.client_name
16 17 18 19 20 21
  end

  def image
    @app.image_uri
  end

22 23 24 25 26 27 28 29
  def terms_of_services
    @app.tos_uri
  end

  def policy
    @app.policy_uri
  end

30
  def name?
31 32 33 34 35 36 37 38 39
    @app.client_name.present?
  end

  def terms_of_services?
    @app.tos_uri.present?
  end

  def policy?
    @app.policy_uri.present?
40 41 42 43
  end

  def url
    client_redirect = URI(@app.redirect_uris[0])
augier's avatar
augier committed
44 45
    client_redirect.path = "/"
    client_redirect.to_s
46 47
  end
end