Class: Mastodon::Client

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

Direct Known Subclasses

REST::Client

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Client

Returns a new instance of Client.

Parameters:

  • options (Hash) (defaults to: {})

Options Hash (options):

  • :base_url (String)

    URL of the instance you want to connect to

  • :bearer_token (String)

    OAuth access token for your authenticated user



10
11
12
13
# File 'lib/mastodon/client.rb', line 10

def initialize(options = {})
  @base_url     = options[:base_url]
  @bearer_token = options[:bearer_token]
end

Instance Attribute Details

#base_urlObject (readonly)

Returns the value of attribute base_url.



5
6
7
# File 'lib/mastodon/client.rb', line 5

def base_url
  @base_url
end

#bearer_tokenObject (readonly)

Returns the value of attribute bearer_token.



5
6
7
# File 'lib/mastodon/client.rb', line 5

def bearer_token
  @bearer_token
end

Instance Method Details

#user_agentString

User agent of the client

Returns:

  • (String)


17
18
19
# File 'lib/mastodon/client.rb', line 17

def user_agent
  @user_agent ||= "MastodonRubyGem/#{Mastodon::Version}"
end