Class: Telegraphist::Client
- Inherits:
-
Object
- Object
- Telegraphist::Client
- Includes:
- HTTParty
- Defined in:
- lib/telegraphist/client.rb
Instance Attribute Summary collapse
-
#authentication_token ⇒ Object
readonly
Returns the value of attribute authentication_token.
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
- #get(path, payload = {}) ⇒ Object
-
#initialize(authentication_token) ⇒ Client
constructor
A new instance of Client.
- #post(path, payload = {}) ⇒ Object
- #url(path) ⇒ Object
Constructor Details
#initialize(authentication_token) ⇒ Client
8 9 10 11 |
# File 'lib/telegraphist/client.rb', line 8 def initialize(authentication_token) @authentication_token = authentication_token = {} end |
Instance Attribute Details
#authentication_token ⇒ Object (readonly)
Returns the value of attribute authentication_token.
6 7 8 |
# File 'lib/telegraphist/client.rb', line 6 def authentication_token @authentication_token end |
#options ⇒ Object (readonly)
Returns the value of attribute options.
6 7 8 |
# File 'lib/telegraphist/client.rb', line 6 def end |
Instance Method Details
#get(path, payload = {}) ⇒ Object
13 14 15 |
# File 'lib/telegraphist/client.rb', line 13 def get(path, payload={}) self.class.get(url(path), .deep_merge(payload)).parsed_response end |
#post(path, payload = {}) ⇒ Object
17 18 19 |
# File 'lib/telegraphist/client.rb', line 17 def post(path, payload={}) self.class.post(url(path), .deep_merge(payload)).parsed_response end |
#url(path) ⇒ Object
21 22 23 |
# File 'lib/telegraphist/client.rb', line 21 def url(path) ['/', 'bot', authentication_token, '/', path].join end |