Sha256: d6149bf1d6c9aa67b24c3e9363ec912677d035c94c40dd0235a3c3ec62fabb85

Contents?: true

Size: 1.32 KB

Versions: 3

Compression:

Stored size: 1.32 KB

Contents

module OmiseGO
  class User < Base
    attributes :id, :username, :provider_user_id, :metadata

    class << self
      def login(provider_user_id:, client: nil)
        request(client).send('login', provider_user_id: provider_user_id).data
      end

      def find(provider_user_id:, client: nil)
        return ErrorHandler.handle(:nil_id) unless provider_user_id
        request(client).send('user.get', provider_user_id: provider_user_id).data
      end

      def create(provider_user_id:, username:, metadata: {}, client: nil)
        request(client).send('user.create', provider_user_id: provider_user_id,
                                            username: username,
                                            metadata: metadata).data
      end

      def update(provider_user_id:, username:, metadata: {}, client: nil)
        request(client).send('user.update', provider_user_id: provider_user_id,
                                            username: username,
                                            metadata: metadata).data
      end
    end

    def login
      login(provider_user_id)
    end

    def update(username:, metadata: {}, client: nil)
      update({
               provider_user_id: provider_user_id,
               username: username,
               metadata: metadata
             }, client)
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
omisego-0.9.6 lib/omisego/user.rb
omisego-0.9.5 lib/omisego/user.rb
omisego-0.9.4 lib/omisego/user.rb