Class: RubyVibe::Client
- Inherits:
-
Object
- Object
- RubyVibe::Client
- Defined in:
- lib/ruby-vibe/client.rb
Overview
This class is almost never used directly by user. Send actual request to viber api and perform type validation for token, name and avatar (must be strings).
Direct Known Subclasses
Instance Attribute Summary collapse
-
#avatar ⇒ Object
Returns the value of attribute avatar.
-
#name ⇒ Object
(also: #sender)
Returns the value of attribute name.
-
#payload_hash ⇒ Object
readonly
Returns the value of attribute payload_hash.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
-
#token ⇒ Object
Returns the value of attribute token.
Instance Method Summary collapse
Constructor Details
#initialize(token: nil, name: nil, avatar: nil) ⇒ Object
34 35 36 37 38 39 40 41 42 43 |
# File 'lib/ruby-vibe/client.rb', line 34 def initialize(token: nil, name: nil, avatar: nil) raise 'Token must be string!' unless token.is_a? String raise 'Sender name must be string' unless name.is_a? String raise 'Avatar URL must use SSL' if !avatar.empty? && !(avatar.start_with? 'https://') @token = token @name = name @avatar = avatar end |
Instance Attribute Details
#avatar ⇒ Object
Returns the value of attribute avatar.
13 14 15 |
# File 'lib/ruby-vibe/client.rb', line 13 def avatar @avatar end |
#name ⇒ Object Also known as: sender
Returns the value of attribute name.
13 14 15 |
# File 'lib/ruby-vibe/client.rb', line 13 def name @name end |
#payload_hash ⇒ Object (readonly)
Returns the value of attribute payload_hash.
15 16 17 |
# File 'lib/ruby-vibe/client.rb', line 15 def payload_hash @payload_hash end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
15 16 17 |
# File 'lib/ruby-vibe/client.rb', line 15 def response @response end |
#token ⇒ Object
Returns the value of attribute token.
13 14 15 |
# File 'lib/ruby-vibe/client.rb', line 13 def token @token end |