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.



49864
49865
49866
49867
49868
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49864

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.



49862
49863
49864
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49862

def unit
  @unit
end

#valueObject (readonly)

Returns the value of attribute value.



49862
49863
49864
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49862

def value
  @value
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



49874
49875
49876
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49874

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

#to_hashObject



49878
49879
49880
49881
49882
49883
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49878

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

#to_jsonObject



49870
49871
49872
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 49870

def to_json
  JSON.dump(to_hash)
end