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.



30280
30281
30282
30283
30284
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30280

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.



30278
30279
30280
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30278

def unit
  @unit
end

#valueObject (readonly)

Returns the value of attribute value.



30278
30279
30280
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30278

def value
  @value
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



30290
30291
30292
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30290

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

#to_hashObject



30294
30295
30296
30297
30298
30299
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30294

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

#to_jsonObject



30286
30287
30288
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 30286

def to_json
  JSON.dump(to_hash)
end