Class: Gitter::API::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/gitter/api/base.rb

Overview

Base model that other Gitter::API models inherit from

See:

  • Gitter::API::Message

  • Gitter::API::Room

  • Gitter::API::User

Direct Known Subclasses

Message, Room, User

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client, data) ⇒ Base

All models should call this in their overrides, and configure their specific model attributes in the override from the @data that was passed in.

Note: @data is set, but is not a formal accessor. Currently just available for debugging if needed.



25
26
27
28
# File 'lib/gitter/api/base.rb', line 25

def initialize client, data # :nodoc:
  @client = client
  @data   = data
end

Instance Attribute Details

#clientObject (readonly)

Configured client that fetched the record

Used for subsequent calls (instance methods)



16
17
18
# File 'lib/gitter/api/base.rb', line 16

def client
  @client
end

Instance Method Details

#api_prefixObject

Helper method for fetching the API prefix from the client



32
33
34
# File 'lib/gitter/api/base.rb', line 32

def api_prefix
  client.api_prefix
end