Class: KlaviyoAPI::Session

Inherits:
Object
  • Object
show all
Defined in:
lib/klaviyo_api/session.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_key) ⇒ Session

Returns a new instance of Session.



7
8
9
# File 'lib/klaviyo_api/session.rb', line 7

def initialize(api_key)
  self.api_key = api_key
end

Instance Attribute Details

#api_keyObject

Returns the value of attribute api_key.



5
6
7
# File 'lib/klaviyo_api/session.rb', line 5

def api_key
  @api_key
end

Class Method Details

.temp(api_key) ⇒ Object



12
13
14
15
16
17
18
19
20
# File 'lib/klaviyo_api/session.rb', line 12

def temp(api_key)
  session = new api_key

  KlaviyoAPI::Base.activate_session session

  yield
ensure
  KlaviyoAPI::Base.reset_session
end