Class: Io::Flow::V0::Models::SessionExpirationConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/flow_commerce/flow_api_v0_client.rb

Overview

Configures session expiration time. We default to 30 minutes to follow Google Analytics

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ SessionExpirationConfig

Returns a new instance of SessionExpirationConfig.



26205
26206
26207
26208
26209
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26205

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  @unit = (x = (x = opts.delete(:unit); x.nil? ? "minute" : x); x.is_a?(::Io::Flow::V0::Models::UnitOfTime) ? x : ::Io::Flow::V0::Models::UnitOfTime.apply(x))
  @value = HttpClient::Preconditions.assert_class('value', (x = opts.delete(:value); x.nil? ? 30 : x), Integer)
end

Instance Attribute Details

#unitObject (readonly)

Returns the value of attribute unit.



26203
26204
26205
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26203

def unit
  @unit
end

#valueObject (readonly)

Returns the value of attribute value.



26203
26204
26205
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26203

def value
  @value
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



26215
26216
26217
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26215

def copy(incoming={})
  SessionExpirationConfig.new(to_hash.merge(HttpClient::Helper.symbolize_keys(incoming)))
end

#to_hashObject



26219
26220
26221
26222
26223
26224
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26219

def to_hash
  {
    :unit => unit.value,
    :value => value
  }
end

#to_jsonObject



26211
26212
26213
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 26211

def to_json
  JSON.dump(to_hash)
end