Sha256: b85b4191626db671267e1bb61fd23d079a3e0c885d5633f669b8e3a5d31d7ee7

Contents?: true

Size: 1.04 KB

Versions: 3

Compression:

Stored size: 1.04 KB

Contents

# frozen_string_literal: true

# Copyright (c) 2019 Valencia Management Group
# All rights reserved.

module TopsConnect
  module Owners
    # Method: GET
    # Endpoint: Owner_GetList
    # Returns: Array<TopsConnect::Owner>
    def owners(property_key = nil)
      query = {}
      query['PropertyKey'] = property_key.to_i if property_key

      get('/owner', query: query).map do |owner_data|
        TopsConnect::Owner.new owner_data
      end
    end

    # Method: GET
    # Endpoint: Owner_Get
    # Returns: TopsConnect::Owner
    def owner(owner_key)
      TopsConnect::Owner.new get("/owner/#{owner_key}")
    end

    # Method: GET
    # Endpoint: Balance_Get
    # Returns: Hash
    def balance(owner_key)
      get "/owner/#{owner_key}/balance"
    end

    # Method: GET
    # Endpoint: Charge_Get
    # Returns: Hash
    def charges(owner_key)
      get "/charge/#{owner_key}"
    end

    # Method: PUT
    # Endpoint: Owner_Put
    # Returns: Hash
    def update_owner!(owner_key, data)
      put "/owner/#{owner_key}", body: data
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
tops_connect-0.7.2 lib/tops_connect/owners.rb
tops_connect-0.7.1 lib/tops_connect/owners.rb
tops_connect-0.7.0 lib/tops_connect/owners.rb