Class: Chatrix::Api::ApiComponent

Inherits:
Object
  • Object
show all
Defined in:
lib/chatrix/api/api_component.rb

Overview

Wraps a matrix instance for use in calling API endpoints.

Direct Known Subclasses

Media, Push, RoomActions, Rooms, Session, Users

Instance Method Summary collapse

Constructor Details

#initialize(matrix) ⇒ ApiComponent

Initializes a new ApiComponent instance.

Parameters:

  • matrix (Matrix)

    The matrix API instance.



10
11
12
# File 'lib/chatrix/api/api_component.rb', line 10

def initialize(matrix)
  @matrix = matrix
end

Instance Method Details

#make_request(*args) {|fragment| ... } ⇒ HTTParty::Response (protected)

Makes an API request using the underlying Matrix instance.

Parameters:

  • args

    Parameters to pass to Matrix#make_request.

Yields:

  • (fragment)

    HTTParty will call the block during the request.

Returns:

  • (HTTParty::Response)

    The HTTParty response object.



20
21
22
# File 'lib/chatrix/api/api_component.rb', line 20

def make_request(*args, &block)
  @matrix.make_request(*args, &block)
end