Sha256: b3a350417ac590a9649a06cc3b0fdd20bea09f4464b40012ccd3348bb00d5127

Contents?: true

Size: 661 Bytes

Versions: 8

Compression:

Stored size: 661 Bytes

Contents

module Lifen
  class Authentication < Base

    attribute :user, Lifen::User

    attribute :uuid, String
    attribute :token, String

    def register!
      json = client.post("authentication/api/register/third_party", {emailAddress: user.email, lastName: user.last_name, firstName: user.first_name})

      self.token    = json["token"]
      self.uuid     = json["accountUuid"]
    end

    def refresh_token
      json = client.post("authentication/api/authenticate/third_party", {accountUuid: user.uuid})

      self.token    = json.first["token"]
    end

    private

      def client
        @client ||= AppAuthenticatedClient.new
      end

  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
lifen-0.2.1 lib/lifen/authentication.rb
lifen-0.2.0 lib/lifen/authentication.rb
lifen-0.1.5 lib/lifen/authentication.rb
lifen-0.1.4 lib/lifen/authentication.rb
lifen-0.1.3 lib/lifen/authentication.rb
lifen-0.1.2 lib/lifen/authentication.rb
lifen-0.1.1 lib/lifen/authentication.rb
lifen-0.1.0 lib/lifen/authentication.rb