Class: MstdnIvory::Client
- Inherits:
-
Object
- Object
- MstdnIvory::Client
- Includes:
- Api
- Defined in:
- lib/mstdn_ivory/client.rb
Constant Summary collapse
- DEFAULT_TIMEOUT =
{ connect: 2, read: 5, write: 20 }
Instance Attribute Summary collapse
-
#base_url ⇒ Object
readonly
Returns the value of attribute base_url.
-
#timeout ⇒ Object
readonly
Returns the value of attribute timeout.
-
#token ⇒ Object
Returns the value of attribute token.
Instance Method Summary collapse
- #headers ⇒ Object
-
#initialize(base_url, token = '', options = {}) ⇒ Client
constructor
A new instance of Client.
Methods included from Rest
Methods included from Request
Methods included from Register
#create_app, #create_authorization_url, #get_access_token
Constructor Details
#initialize(base_url, token = '', options = {}) ⇒ Client
13 14 15 16 17 |
# File 'lib/mstdn_ivory/client.rb', line 13 def initialize(base_url, token = '', = {}) @base_url = base_url @token = token @timeout = DEFAULT_TIMEOUT.merge([:timeout] || {}) end |
Instance Attribute Details
#base_url ⇒ Object (readonly)
Returns the value of attribute base_url.
8 9 10 |
# File 'lib/mstdn_ivory/client.rb', line 8 def base_url @base_url end |
#timeout ⇒ Object (readonly)
Returns the value of attribute timeout.
9 10 11 |
# File 'lib/mstdn_ivory/client.rb', line 9 def timeout @timeout end |
#token ⇒ Object
Returns the value of attribute token.
7 8 9 |
# File 'lib/mstdn_ivory/client.rb', line 7 def token @token end |
Instance Method Details
#headers ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/mstdn_ivory/client.rb', line 19 def headers { accept: '*/*', user_agent:'mstdn ivory', authorization: "Bearer #{@token}" } end |