Class: Shikimori::API::Client
- Inherits:
-
Object
- Object
- Shikimori::API::Client
- Defined in:
- lib/shikimori/api/client.rb
Overview
Client to call shikimoris API
Constant Summary collapse
- DEFAULT_SITE_URL =
Returns Default site url.
'https://shikimori.one/'
Instance Attribute Summary collapse
-
#v1 ⇒ Object
readonly
Returns the value of attribute v1.
-
#v2 ⇒ Object
readonly
Returns the value of attribute v2.
Instance Method Summary collapse
-
#initialize(site = DEFAULT_SITE_URL, app_name: nil, access_token: nil, refresh_token: nil) ⇒ Client
constructor
A new instance of Client.
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
#v1 ⇒ Object (readonly)
Returns the value of attribute v1.
15 16 17 |
# File 'lib/shikimori/api/client.rb', line 15 def v1 @v1 end |
#v2 ⇒ Object (readonly)
Returns the value of attribute v2.
15 16 17 |
# File 'lib/shikimori/api/client.rb', line 15 def v2 @v2 end |