Class: Io::Flow::V0::Clients::MerchantApplications

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

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ MerchantApplications

Returns a new instance of MerchantApplications.



7449
7450
7451
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7449

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

Instance Method Details

#get_channel_and_merchant_and_applications_and_summary_by_channel_id(channel_id) ⇒ Object



7467
7468
7469
7470
7471
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7467

def get_channel_and_merchant_and_applications_and_summary_by_channel_id(channel_id)
  HttpClient::Preconditions.assert_class('channel_id', channel_id, String)
  r = @client.request("/channel/#{CGI.escape(channel_id)}/merchant/applications/summary").get
  ::Io::Flow::V0::Models::MerchantApplicationsSummary.from_json(r)
end

#get_channel_and_merchant_and_applications_by_channel_id(channel_id, incoming = {}) ⇒ Object

Returns the list of onboarding applications in a channel.



7454
7455
7456
7457
7458
7459
7460
7461
7462
7463
7464
7465
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7454

def get_channel_and_merchant_and_applications_by_channel_id(channel_id, incoming={})
  HttpClient::Preconditions.assert_class('channel_id', channel_id, String)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  query = {
    :id => (x = opts.delete(:id); x.nil? ? nil : HttpClient::Preconditions.assert_class('id', x, Array).map { |v| HttpClient::Preconditions.assert_class('id', v, String) }),
    :limit => HttpClient::Preconditions.assert_class('limit', (x = opts.delete(:limit); x.nil? ? 25 : x), Integer),
    :offset => HttpClient::Preconditions.assert_class('offset', (x = opts.delete(:offset); x.nil? ? 0 : x), Integer),
    :sort => HttpClient::Preconditions.assert_class('sort', (x = opts.delete(:sort); x.nil? ? "-created_at" : x), String)
  }.delete_if { |k, v| v.nil? }
  r = @client.request("/channel/#{CGI.escape(channel_id)}/merchant/applications").with_query(query).get
  r.map { |x| ::Io::Flow::V0::Models::MerchantApplication.from_json(x) }
end

#get_merchant_and_applications_and_latest_by_organization(organization) ⇒ Object

See most recent application for organization



7495
7496
7497
7498
7499
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7495

def get_merchant_and_applications_and_latest_by_organization(organization)
  HttpClient::Preconditions.assert_class('organization', organization, String)
  r = @client.request("/#{CGI.escape(organization)}/merchant/applications/latest").get
  ::Io::Flow::V0::Models::MerchantApplication.from_json(r)
end

#get_merchant_and_applications_and_summary_by_organization(organization) ⇒ Object



7501
7502
7503
7504
7505
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7501

def get_merchant_and_applications_and_summary_by_organization(organization)
  HttpClient::Preconditions.assert_class('organization', organization, String)
  r = @client.request("/#{CGI.escape(organization)}/merchant/applications/summary").get
  ::Io::Flow::V0::Models::MerchantApplicationsSummary.from_json(r)
end

#get_merchant_and_applications_by_organization(organization, incoming = {}) ⇒ Object

See all applications for the channel



7474
7475
7476
7477
7478
7479
7480
7481
7482
7483
7484
7485
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7474

def get_merchant_and_applications_by_organization(organization, incoming={})
  HttpClient::Preconditions.assert_class('organization', organization, String)
  opts = HttpClient::Helper.symbolize_keys(incoming)
  query = {
    :id => (x = opts.delete(:id); x.nil? ? nil : HttpClient::Preconditions.assert_class('id', x, Array).map { |v| HttpClient::Preconditions.assert_class('id', v, String) }),
    :limit => HttpClient::Preconditions.assert_class('limit', (x = opts.delete(:limit); x.nil? ? 25 : x), Integer),
    :offset => HttpClient::Preconditions.assert_class('offset', (x = opts.delete(:offset); x.nil? ? 0 : x), Integer),
    :sort => HttpClient::Preconditions.assert_class('sort', (x = opts.delete(:sort); x.nil? ? "-created_at" : x), String)
  }.delete_if { |k, v| v.nil? }
  r = @client.request("/#{CGI.escape(organization)}/merchant/applications").with_query(query).get
  r.map { |x| ::Io::Flow::V0::Models::MerchantApplication.from_json(x) }
end

#get_merchant_and_applications_by_organization_and_id(organization, id) ⇒ Object

See details of an application



7508
7509
7510
7511
7512
7513
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7508

def get_merchant_and_applications_by_organization_and_id(organization, id)
  HttpClient::Preconditions.assert_class('organization', organization, String)
  HttpClient::Preconditions.assert_class('id', id, String)
  r = @client.request("/#{CGI.escape(organization)}/merchant/applications/#{CGI.escape(id)}").get
  ::Io::Flow::V0::Models::MerchantApplication.from_json(r)
end

#post_merchant_and_applications_by_organization(organization, merchant_application_form) ⇒ Object



7487
7488
7489
7490
7491
7492
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7487

def post_merchant_and_applications_by_organization(organization, merchant_application_form)
  HttpClient::Preconditions.assert_class('organization', organization, String)
  (x = merchant_application_form; x.is_a?(::Io::Flow::V0::Models::MerchantApplicationForm) ? x : ::Io::Flow::V0::Models::MerchantApplicationForm.from_json(x))
  r = @client.request("/#{CGI.escape(organization)}/merchant/applications").with_json(merchant_application_form.to_json).post
  ::Io::Flow::V0::Models::MerchantApplication.from_json(r)
end

#put_merchant_and_applications_by_organization_and_id(organization, id, merchant_application_put_form) ⇒ Object



7515
7516
7517
7518
7519
7520
7521
# File 'lib/flow_commerce/flow_api_v0_client.rb', line 7515

def put_merchant_and_applications_by_organization_and_id(organization, id, merchant_application_put_form)
  HttpClient::Preconditions.assert_class('organization', organization, String)
  HttpClient::Preconditions.assert_class('id', id, String)
  (x = merchant_application_put_form; x.is_a?(::Io::Flow::V0::Models::MerchantApplicationPutForm) ? x : ::Io::Flow::V0::Models::MerchantApplicationPutForm.from_json(x))
  r = @client.request("/#{CGI.escape(organization)}/merchant/applications/#{CGI.escape(id)}").with_json(merchant_application_put_form.to_json).put
  ::Io::Flow::V0::Models::MerchantApplication.from_json(r)
end