Class: Shikimori::API::Client

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

Overview

Client to call shikimoris API

Constant Summary collapse

DEFAULT_SITE_URL =

Returns Default site url.

Returns:

  • (String)

    Default site url

'https://shikimori.one/'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(site = DEFAULT_SITE_URL, app_name: nil, access_token: nil, refresh_token: nil) ⇒ Client

Returns a new instance of Client.



17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/shikimori/api/client.rb', line 17

def initialize(site = DEFAULT_SITE_URL, app_name: nil, access_token: nil, refresh_token: nil)
  rest = REST.new(
    access_token: access_token,
    refresh_token: refresh_token,
    app_name: app_name
  )
  @v1 = V1.new(
    base_url: URI.new(site).join('api/'),
    rest: rest
  )
  @v2 = V2.new(
    base_url: URI.new(site).join('api/v2/'),
    rest: rest
  )
end

Instance Attribute Details

#v1Object (readonly)

Returns the value of attribute v1.



15
16
17
# File 'lib/shikimori/api/client.rb', line 15

def v1
  @v1
end

#v2Object (readonly)

Returns the value of attribute v2.



15
16
17
# File 'lib/shikimori/api/client.rb', line 15

def v2
  @v2
end