Sha256: 769c65b9133e301afe1c86fb1caba777a943248913753adb48a00d93f9d32fc5

Contents?: true

Size: 839 Bytes

Versions: 5

Compression:

Stored size: 839 Bytes

Contents

# frozen_string_literal: true

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
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
tops_connect-0.6.3 lib/tops_connect/owners.rb
tops_connect-0.6.2 lib/tops_connect/owners.rb
tops_connect-0.6.1 lib/tops_connect/owners.rb
tops_connect-0.6.0 lib/tops_connect/owners.rb
tops_connect-0.5.0 lib/tops_connect/owners.rb