Sha256: 32ca4f63752172db03317584e235361048e483f51a494c4c798c5aca2a563b78

Contents?: true

Size: 849 Bytes

Versions: 5

Compression:

Stored size: 849 Bytes

Contents

# frozen_string_literal: true

module Tikkie
  module Api
    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::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::Responses::User.new(response)
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
tikkie-api-0.2.2 lib/tikkie/api/requests/users.rb
tikkie-api-0.2.1 lib/tikkie/api/requests/users.rb
tikkie-api-0.2.0 lib/tikkie/api/requests/users.rb
tikkie-api-0.1.1 lib/tikkie/api/requests/users.rb
tikkie-api-0.1.0 lib/tikkie/api/requests/users.rb