Class: Mixpanel::ServiceAccountCredentials
- Inherits:
-
Object
- Object
- Mixpanel::ServiceAccountCredentials
- Defined in:
- lib/mixpanel-ruby/credentials.rb
Overview
Service account credentials for server-to-server authentication This is the recommended authentication method over API keys
Instance Attribute Summary collapse
-
#project_id ⇒ Object
readonly
Returns the value of attribute project_id.
-
#secret ⇒ Object
readonly
Returns the value of attribute secret.
-
#username ⇒ Object
readonly
Returns the value of attribute username.
Instance Method Summary collapse
-
#initialize(username, secret, project_id) ⇒ ServiceAccountCredentials
constructor
Create service account credentials.
Constructor Details
#initialize(username, secret, project_id) ⇒ ServiceAccountCredentials
Create service account credentials
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/mixpanel-ruby/credentials.rb', line 11 def initialize(username, secret, project_id) raise ArgumentError, 'username is required' if username.nil? || username.empty? raise ArgumentError, 'secret is required' if secret.nil? || secret.empty? raise ArgumentError, 'project_id is required' if project_id.nil? # Convert project_id to string if it's an integer (Mixpanel dashboard shows numeric IDs) project_id = project_id.to_s if project_id.is_a?(Integer) raise ArgumentError, 'project_id is required' if project_id.empty? @username = username @secret = secret @project_id = project_id end |
Instance Attribute Details
#project_id ⇒ Object (readonly)
Returns the value of attribute project_id.
5 6 7 |
# File 'lib/mixpanel-ruby/credentials.rb', line 5 def project_id @project_id end |
#secret ⇒ Object (readonly)
Returns the value of attribute secret.
5 6 7 |
# File 'lib/mixpanel-ruby/credentials.rb', line 5 def secret @secret end |
#username ⇒ Object (readonly)
Returns the value of attribute username.
5 6 7 |
# File 'lib/mixpanel-ruby/credentials.rb', line 5 def username @username end |