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.



8195
8196
8197
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8195

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

Instance Method Details

#delete_by_session(session) ⇒ Object



8276
8277
8278
8279
8280
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8276

def delete_by_session(session)
  HttpClient::Preconditions.assert_class('session', session, String)
  r = @client.request("/sessions/#{CGI.escape(session)}").delete
  nil
end

#delete_shopify_by_session(session) ⇒ Object



8219
8220
8221
8222
8223
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8219

def delete_shopify_by_session(session)
  HttpClient::Preconditions.assert_class('session', session, String)
  r = @client.request("/sessions/shopify/#{CGI.escape(session)}").delete
  nil
end

#get_by_session(session) ⇒ Object



8259
8260
8261
8262
8263
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8259

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

#get_shopify_by_session(session) ⇒ Object



8206
8207
8208
8209
8210
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8206

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

#post_organizations_by_organization(organization, session_form, incoming = {}) ⇒ Object



8248
8249
8250
8251
8252
8253
8254
8255
8256
8257
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8248

def post_organizations_by_organization(organization, session_form, incoming={})
  HttpClient::Preconditions.assert_class('organization', organization, String)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  query = {
    :context => (x = opts.delete(:context); x.nil? ? nil : HttpClient::Preconditions.assert_class('context', x, String))
  }.delete_if { |k, v| v.nil? }
  (x = session_form; x.is_a?(::Io::Flow::V0::Models::SessionForm) ? x : ::Io::Flow::V0::Models::SessionForm.new(x))
  r = @client.request("/sessions/organizations/#{CGI.escape(organization)}").with_query(query).with_json(session_form.to_json).post
  ::Io::Flow::V0::Models::OrganizationSession.new(r)
end

#post_shopify_and_organizations_by_organization(organization, session_form) ⇒ Object



8199
8200
8201
8202
8203
8204
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8199

def post_shopify_and_organizations_by_organization(organization, session_form)
  HttpClient::Preconditions.assert_class('organization', organization, String)
  (x = session_form; x.is_a?(::Io::Flow::V0::Models::SessionForm) ? x : ::Io::Flow::V0::Models::SessionForm.new(x))
  r = @client.request("/sessions/shopify/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, incoming = {}) ⇒ Object



8265
8266
8267
8268
8269
8270
8271
8272
8273
8274
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8265

def put_by_session(session, session_put_form, incoming={})
  HttpClient::Preconditions.assert_class('session', session, String)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  query = {
    :context => (x = opts.delete(:context); x.nil? ? nil : HttpClient::Preconditions.assert_class('context', x, String))
  }.delete_if { |k, v| v.nil? }
  (x = session_put_form; x.is_a?(::Io::Flow::V0::Models::SessionPutForm) ? x : ::Io::Flow::V0::Models::SessionPutForm.new(x))
  r = @client.request("/sessions/#{CGI.escape(session)}").with_query(query).with_json(session_put_form.to_json).put
  ::Io::Flow::V0::Models::Session.from_json(r)
end

#put_clear_by_session(session) ⇒ Object

Clears the session geo parameters



8283
8284
8285
8286
8287
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8283

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

#put_organizations_by_session_and_organization(session, organization, session_put_form, incoming = {}) ⇒ Object



8289
8290
8291
8292
8293
8294
8295
8296
8297
8298
8299
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8289

def put_organizations_by_session_and_organization(session, organization, session_put_form, incoming={})
  HttpClient::Preconditions.assert_class('session', session, String)
  HttpClient::Preconditions.assert_class('organization', organization, String)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  query = {
    :context => (x = opts.delete(:context); x.nil? ? nil : HttpClient::Preconditions.assert_class('context', x, String))
  }.delete_if { |k, v| v.nil? }
  (x = session_put_form; x.is_a?(::Io::Flow::V0::Models::SessionPutForm) ? x : ::Io::Flow::V0::Models::SessionPutForm.new(x))
  r = @client.request("/sessions/#{CGI.escape(session)}/organizations/#{CGI.escape(organization)}").with_query(query).with_json(session_put_form.to_json).put
  ::Io::Flow::V0::Models::OrganizationSession.new(r)
end

#put_reset_by_session(session, session_put_form, incoming = {}) ⇒ Object

Resets the session based on the provided geo parameters.



8302
8303
8304
8305
8306
8307
8308
8309
8310
8311
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8302

def put_reset_by_session(session, session_put_form, incoming={})
  HttpClient::Preconditions.assert_class('session', session, String)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  query = {
    :context => (x = opts.delete(:context); x.nil? ? nil : HttpClient::Preconditions.assert_class('context', x, String))
  }.delete_if { |k, v| v.nil? }
  (x = session_put_form; x.is_a?(::Io::Flow::V0::Models::SessionPutForm) ? x : ::Io::Flow::V0::Models::SessionPutForm.new(x))
  r = @client.request("/sessions/#{CGI.escape(session)}/reset").with_query(query).with_json(session_put_form.to_json).put
  ::Io::Flow::V0::Models::Session.from_json(r)
end

#put_shopify_and_clear_by_session(session) ⇒ Object

Clears the session geo parameters



8226
8227
8228
8229
8230
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8226

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

#put_shopify_and_organizations_by_session_and_organization(session, organization, session_put_form) ⇒ Object



8232
8233
8234
8235
8236
8237
8238
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8232

def put_shopify_and_organizations_by_session_and_organization(session, organization, session_put_form)
  HttpClient::Preconditions.assert_class('session', session, String)
  HttpClient::Preconditions.assert_class('organization', organization, String)
  (x = session_put_form; x.is_a?(::Io::Flow::V0::Models::SessionPutForm) ? x : ::Io::Flow::V0::Models::SessionPutForm.new(x))
  r = @client.request("/sessions/shopify/#{CGI.escape(session)}/organizations/#{CGI.escape(organization)}").with_json(session_put_form.to_json).put
  ::Io::Flow::V0::Models::OrganizationSession.new(r)
end

#put_shopify_and_reset_by_session(session, session_put_form) ⇒ Object

Resets the session based on the provided geo parameters.



8241
8242
8243
8244
8245
8246
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8241

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

#put_shopify_by_session(session, session_put_form) ⇒ Object



8212
8213
8214
8215
8216
8217
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 8212

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