Class: Gupshup::REST::Client
- Inherits:
-
Object
- Object
- Gupshup::REST::Client
- Defined in:
- lib/gupshup-rb/rest/client.rb
Overview
A client for accessing the Gupshup API.
Constant Summary collapse
- @@default_region =
'us1'
Instance Attribute Summary collapse
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#edge ⇒ Object
Returns the value of attribute edge.
-
#http_client ⇒ Object
Returns the value of attribute http_client.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#password ⇒ Object
Returns the value of attribute password.
-
#region ⇒ Object
Returns the value of attribute region.
-
#src_name ⇒ Object
Returns the value of attribute src_name.
-
#user_agent_extensions ⇒ Object
Returns the value of attribute user_agent_extensions.
-
#username ⇒ Object
Returns the value of attribute username.
Instance Method Summary collapse
-
#initialize(src_name = nil, api_key = nil) ⇒ Client
constructor
Initializes the Gupshup Client.
- #messages(to = nil, from = nil, body = nil, api_key = nil, src_name = nil) ⇒ Object
-
#to_s ⇒ Object
Provide a user friendly representation.
Constructor Details
#initialize(src_name = nil, api_key = nil) ⇒ Client
Initializes the Gupshup Client
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/gupshup-rb/rest/client.rb', line 14 def initialize(src_name=nil, api_key=nil) @src_name = src_name @api_key = api_key @auth = [@src_name, @api_key] #$@logger = logger || Gupshup.logger @user_agent_extensions = user_agent_extensions || [] # Domains @api = nil @content = nil @conversations = nil @events = nil @media = nil @messaging = nil @video = nil end |
Instance Attribute Details
#api_key ⇒ Object
Returns the value of attribute api_key.
10 11 12 |
# File 'lib/gupshup-rb/rest/client.rb', line 10 def api_key @api_key end |
#edge ⇒ Object
Returns the value of attribute edge.
10 11 12 |
# File 'lib/gupshup-rb/rest/client.rb', line 10 def edge @edge end |
#http_client ⇒ Object
Returns the value of attribute http_client.
10 11 12 |
# File 'lib/gupshup-rb/rest/client.rb', line 10 def http_client @http_client end |
#logger ⇒ Object
Returns the value of attribute logger.
10 11 12 |
# File 'lib/gupshup-rb/rest/client.rb', line 10 def logger @logger end |
#password ⇒ Object
Returns the value of attribute password.
10 11 12 |
# File 'lib/gupshup-rb/rest/client.rb', line 10 def password @password end |
#region ⇒ Object
Returns the value of attribute region.
10 11 12 |
# File 'lib/gupshup-rb/rest/client.rb', line 10 def region @region end |
#src_name ⇒ Object
Returns the value of attribute src_name.
10 11 12 |
# File 'lib/gupshup-rb/rest/client.rb', line 10 def src_name @src_name end |
#user_agent_extensions ⇒ Object
Returns the value of attribute user_agent_extensions.
10 11 12 |
# File 'lib/gupshup-rb/rest/client.rb', line 10 def user_agent_extensions @user_agent_extensions end |
#username ⇒ Object
Returns the value of attribute username.
10 11 12 |
# File 'lib/gupshup-rb/rest/client.rb', line 10 def username @username end |
Instance Method Details
#messages(to = nil, from = nil, body = nil, api_key = nil, src_name = nil) ⇒ Object
31 32 33 34 35 |
# File 'lib/gupshup-rb/rest/client.rb', line 31 def (to=nil, from=nil, body=nil, api_key=nil, src_name=nil) = Gupshup::REST::Api::V1::MessageList.new('v1', src_name: src_name) .create(to: to, from: from, body: body, media_url: '', content_type: 'text', api_key: api_key, src_name: src_name) end |
#to_s ⇒ Object
Provide a user friendly representation
38 39 40 |
# File 'lib/gupshup-rb/rest/client.rb', line 38 def to_s "#<Gupshup::REST::Client #{@src_name}>" end |