Class: SendPulse::Api
- Inherits:
-
Object
- Object
- SendPulse::Api
- Defined in:
- lib/sendpulse/api.rb
Direct Known Subclasses
EmailService::MailingList, EmailService::Sender, SmtpService
Instance Attribute Summary collapse
-
#client_id ⇒ Object
readonly
Returns the value of attribute client_id.
-
#client_secret ⇒ Object
readonly
Returns the value of attribute client_secret.
-
#protocol ⇒ Object
readonly
Returns the value of attribute protocol.
-
#token ⇒ Object
readonly
Returns the value of attribute token.
Instance Method Summary collapse
-
#initialize(client_id, client_secret, protocol = 'https', token = '') ⇒ Api
constructor
A new instance of Api.
Constructor Details
#initialize(client_id, client_secret, protocol = 'https', token = '') ⇒ Api
9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/sendpulse/api.rb', line 9 def initialize(client_id, client_secret, protocol = 'https', token = '') main_url = SendPulse::Host.main_url @url = "#{protocol}://#{main_url}" @client_id = client_id @client_secret = client_secret @protocol = protocol @refresh_token = 0 @token = token if @token.nil? || @token.empty? raise 'Could not connect to API, check your CLIENT_ID and CLIENT_SECRET' unless refresh_token end end |
Instance Attribute Details
#client_id ⇒ Object (readonly)
Returns the value of attribute client_id.
7 8 9 |
# File 'lib/sendpulse/api.rb', line 7 def client_id @client_id end |
#client_secret ⇒ Object (readonly)
Returns the value of attribute client_secret.
7 8 9 |
# File 'lib/sendpulse/api.rb', line 7 def client_secret @client_secret end |
#protocol ⇒ Object (readonly)
Returns the value of attribute protocol.
7 8 9 |
# File 'lib/sendpulse/api.rb', line 7 def protocol @protocol end |
#token ⇒ Object (readonly)
Returns the value of attribute token.
7 8 9 |
# File 'lib/sendpulse/api.rb', line 7 def token @token end |