Sha256: 3d310f172ed8d66d31fdf1a99ad15ac863084b1d826722ca04ea51a029a41e43
Contents?: true
Size: 1.25 KB
Versions: 1
Compression:
Stored size: 1.25 KB
Contents
# frozen_string_literal: true module Iwoca class Customer # The POST request should be used to create an iwoca account for the customer. It's always the # first endpoint and method you should call when submitting a new customer. It returns a # customer_id used to identify the customer in all future requests. # # Successful request will return a 201 status code and a JSON response containing a customer_id: # Example: { data: { customer_id: "fd48781e-3ad3-4a94-b4a6-60fafeebab0b" } } def self.create(data: {}) # Validate the schema first, to avoid making a request with invalid data. JSON::Validator.validate!('lib/iwoca/schemas/customer_payload.json', data.to_json) Iwoca.connection.post('customers/', data) end # The PUT request should be used to add or update data for a customer. Note that the entire # State should be submitted each time you use this endpoint, even if you are just updating a # few fields. def self.update(customer_id:, data: {}) Iwoca.connection.put("customers/#{customer_id}/", data) end # Get a login link for a customer from a given customer_id def self.login_link(customer_id:) Iwoca.connection.get("customers/#{customer_id}/login_link/") end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
iwoca-1.1.0 | lib/iwoca/customer.rb |