Class: Medium::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/medium/client.rb

Overview

The Client class is used to interact with the resources the Medium API exposes.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(auth_creds) ⇒ Client

Creates a new instance of Medium::Client.

Parameters:

  • auth_creds (Hash)

    The credentials to use for authentication with the Medium API. This can be a self provided :integration_token. OAuth support to be added in the future.



15
16
17
18
19
20
21
# File 'lib/medium/client.rb', line 15

def initialize(auth_creds)
  @client = Hurley::Client.new 'https://api.medium.com/v1/'
  @client.connection = Hurley::HttpCache.new
  auth_headers_with auth_creds

  true
end

Instance Attribute Details

#postsMedium::Users (readonly)

Create a posts resource sub-client if necessary.

Returns:



8
9
10
# File 'lib/medium/client.rb', line 8

def posts
  @posts
end

#usersMedium::Users (readonly)

Create a user resource sub-client if necessary.

Returns:



8
9
10
# File 'lib/medium/client.rb', line 8

def users
  @users
end