Class: LineNotifyClient::HttpClient
- Inherits:
-
Object
- Object
- LineNotifyClient::HttpClient
- Defined in:
- lib/line_notify_client/http_client.rb
Overview
## LineNotify::Client A class for LINE Notify API client.
Constant Summary collapse
- HOST =
'notify-api.line.me'
- ACCEPT =
'application/json'
- USER_AGENT =
'LineNotify Ruby'
- HEADERS =
{ 'Accept' => ACCEPT, 'User-Agent' => USER_AGENT }.freeze
Instance Method Summary collapse
-
#initialize(access_token) ⇒ HttpClient
constructor
A new instance of HttpClient.
-
#notify(message, options = {}) ⇒ Object
### LineNotify::Client#notify Sends notifications to users or groups that are related to an access token.
-
#revoke ⇒ Object
### LineNotify::Client#revoke Disable an access token.
-
#status ⇒ Object
### LineNotify::Client#status Check the validity of an access token.
Constructor Details
#initialize(access_token) ⇒ HttpClient
Returns a new instance of HttpClient.
13 14 15 |
# File 'lib/line_notify_client/http_client.rb', line 13 def initialize(access_token) @access_token = access_token end |
Instance Method Details
#notify(message, options = {}) ⇒ Object
### LineNotify::Client#notify Sends notifications to users or groups that are related to an access token.
21 22 23 24 |
# File 'lib/line_notify_client/http_client.rb', line 21 def notify(, = {}) params = { message: }.merge() post('/api/notify', params, ) end |
#revoke ⇒ Object
### LineNotify::Client#revoke Disable an access token.
38 39 40 |
# File 'lib/line_notify_client/http_client.rb', line 38 def revoke post('/api/revoke') end |
#status ⇒ Object
### LineNotify::Client#status Check the validity of an access token.
30 31 32 |
# File 'lib/line_notify_client/http_client.rb', line 30 def status get('/api/status') end |