Class: Io::Flow::V0::Clients::Sessions

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

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Sessions

Returns a new instance of Sessions.



3922
3923
3924
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 3922

def initialize(client)
  @client = HttpClient::Preconditions.assert_class('client', client, ::Io::Flow::V0::Client)
end

Instance Method Details

#get_by_session(session) ⇒ Object



3926
3927
3928
3929
3930
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 3926

def get_by_session(session)
  HttpClient::Preconditions.assert_class('session', session, String)
  r = @client.request("/sessions/#{CGI.escape(session)}").get
  ::Io::Flow::V0::Models::Session.from_json(r)
end

#post_organizations_by_organization(organization, session_form) ⇒ Object



3948
3949
3950
3951
3952
3953
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 3948

def post_organizations_by_organization(organization, session_form)
  HttpClient::Preconditions.assert_class('organization', organization, String)
  HttpClient::Preconditions.assert_class('session_form', session_form, ::Io::Flow::V0::Models::SessionForm)
  r = @client.request("/sessions/organizations/#{CGI.escape(organization)}").with_json(session_form.to_json).post
  ::Io::Flow::V0::Models::OrganizationSession.new(r)
end

#put_by_session(session, session_put_form) ⇒ Object



3932
3933
3934
3935
3936
3937
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 3932

def put_by_session(session, session_put_form)
  HttpClient::Preconditions.assert_class('session', session, String)
  HttpClient::Preconditions.assert_class('session_put_form', session_put_form, ::Io::Flow::V0::Models::SessionPutForm)
  r = @client.request("/sessions/#{CGI.escape(session)}").with_json(session_put_form.to_json).put
  ::Io::Flow::V0::Models::Session.from_json(r)
end

#put_reset_by_session(session, session_form) ⇒ Object

Resets the session - returned session will be identical to the result of using POST to create a session, except for we preserve the session id



3941
3942
3943
3944
3945
3946
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 3941

def put_reset_by_session(session, session_form)
  HttpClient::Preconditions.assert_class('session', session, String)
  HttpClient::Preconditions.assert_class('session_form', session_form, ::Io::Flow::V0::Models::SessionForm)
  r = @client.request("/sessions/#{CGI.escape(session)}/reset").with_json(session_form.to_json).put
  ::Io::Flow::V0::Models::Session.from_json(r)
end