Class: Io::Flow::V0::Models::SessionVisit

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

Overview

A session visit expires after a configurable period of inactivity (e.g. 30 minutes).

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(incoming = {}) ⇒ SessionVisit

Returns a new instance of SessionVisit.



65647
65648
65649
65650
65651
65652
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 65647

def initialize(incoming={})
  opts = HttpClient::Helper.symbolize_keys(incoming)
  HttpClient::Preconditions.require_keys(opts, [:id, :expires_at], 'SessionVisit')
  @id = HttpClient::Preconditions.assert_class('id', opts.delete(:id), String)
  @expires_at = HttpClient::Preconditions.assert_class('expires_at', HttpClient::Helper.to_date_time_iso8601(opts.delete(:expires_at)), DateTime)
end

Instance Attribute Details

#expires_atObject (readonly)

Returns the value of attribute expires_at.



65645
65646
65647
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 65645

def expires_at
  @expires_at
end

#idObject (readonly)

Returns the value of attribute id.



65645
65646
65647
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 65645

def id
  @id
end

Instance Method Details

#copy(incoming = {}) ⇒ Object



65658
65659
65660
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 65658

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

#to_hashObject



65662
65663
65664
65665
65666
65667
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 65662

def to_hash
  {
    :id => id,
    :expires_at => expires_at
  }
end

#to_jsonObject



65654
65655
65656
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 65654

def to_json
  JSON.dump(to_hash)
end