Sha256: 8d94db660cd07f489dd73de0eaf8406f20c9bf2aab210144ccb3e82c18b4667b

Contents?: true

Size: 923 Bytes

Versions: 1

Compression:

Stored size: 923 Bytes

Contents

# frozen_string_literal: true

module Tikkie
  module Api
    module V1
      module Requests
        # Users operations at Tikkie.
        class Users
          def initialize(request)
            @request = request
          end

          def list(platform_token)
            response = @request.get("/tikkie/platforms/#{platform_token}/users")
            Tikkie::Api::V1::Responses::Users.new(response)
          end

          def create(platform_token, options = {})
            params = {
              name: options.fetch(:name),
              phoneNumber: options.fetch(:phone_number),
              iban: options.fetch(:iban),
              bankAccountLabel: options.fetch(:bank_account_label)
            }
            response = @request.post("/tikkie/platforms/#{platform_token}/users", params)

            Tikkie::Api::V1::Responses::User.new(response)
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tikkie-api-2.0.0 lib/tikkie/api/v1/requests/users.rb