Sha256: 28105bddcdf7456a2a5107fedf0c15a300af7ba57263462ea8e128cda013aef2

Contents?: true

Size: 608 Bytes

Versions: 10

Compression:

Stored size: 608 Bytes

Contents

module Helium
  class User < Resource
    attr_reader :name, :email, :pending_invite
    alias_method :pending_invite?, :pending_invite

    def initialize(opts = {})
      super(opts)

      @name           = @params.dig('attributes', 'name')
      @email          = @params.dig('meta', 'email')
      @pending_invite = @params.dig('meta', 'pending_invite')
    end

    def resource_path
      "/user"
    end

    # TODO can probably generalize this a bit more
    def as_json
      super.merge({
        name: name,
        email: email,
        pending_invite: pending_invite
      })
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
helium-ruby-0.26.0 lib/helium/user.rb
helium-ruby-0.25.0 lib/helium/user.rb
helium-ruby-0.24.0 lib/helium/user.rb
helium-ruby-0.23.0 lib/helium/user.rb
helium-ruby-0.22.0 lib/helium/user.rb
helium-ruby-0.21.0 lib/helium/user.rb
helium-ruby-0.20.0 lib/helium/user.rb
helium-ruby-0.19.0 lib/helium/user.rb
helium-ruby-0.18.0 lib/helium/user.rb
helium-ruby-0.17.0 lib/helium/user.rb