Class: Annict::Client
- Inherits:
-
Object
- Object
- Annict::Client
- Includes:
- ApiMethods
- Defined in:
- lib/annict/client.rb
Constant Summary collapse
- ENDPOINT_BASE_URL =
"https://api.annict.com"
Instance Attribute Summary collapse
-
#access_token ⇒ Object
readonly
Returns the value of attribute access_token.
Instance Method Summary collapse
- #annict_connection ⇒ Object
-
#initialize(access_token: nil) ⇒ Client
constructor
A new instance of Client.
- #send_get(path, params = {}) ⇒ Object
- #send_post(path, params = {}) ⇒ Object
- #send_request(method, path, params) ⇒ Object
Methods included from ApiMethods
#activities, #add_record, #change_status, #episodes, #followers, #following, #following_activities, #me, #own_works, #programs, #records, #users, #works
Constructor Details
#initialize(access_token: nil) ⇒ Client
Returns a new instance of Client.
12 13 14 |
# File 'lib/annict/client.rb', line 12 def initialize(access_token: nil) @access_token = access_token end |
Instance Attribute Details
#access_token ⇒ Object (readonly)
Returns the value of attribute access_token.
15 16 17 |
# File 'lib/annict/client.rb', line 15 def access_token @access_token end |
Instance Method Details
#annict_connection ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/annict/client.rb', line 29 def annict_connection @annict_connection ||= Faraday.new() do |faraday| faraday.request :json faraday.response :json faraday.adapter Faraday.default_adapter end end |
#send_get(path, params = {}) ⇒ Object
17 18 19 |
# File 'lib/annict/client.rb', line 17 def send_get(path, params = {}) send_request(:get, path, params) end |
#send_post(path, params = {}) ⇒ Object
21 22 23 |
# File 'lib/annict/client.rb', line 21 def send_post(path, params = {}) send_request(:post, path, params) end |