Sha256: b6616b756fcc7add43fb066ff967a46b9034c2aafbb7f4b41f5681c709d19d7c

Contents?: true

Size: 921 Bytes

Versions: 2

Compression:

Stored size: 921 Bytes

Contents

# frozen_string_literal: true

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

module TopsConnect
  module Communities
    # Method: GET
    # Endpoint: Community_GetList
    # Returns: Array<TopsConnect::Community>
    def communities
      get('/community').map do |community_data|
        TopsConnect::Community.new community_data
      end
    end

    # Method: GET
    # Endpoint: Community_Get
    # Returns: TopsConnect::Community
    def community
      TopsConnect::Community.new get("/community/#{@community_id}")
    end

    # Method: GET
    # Endpoint: ChargeCode_GetList
    # Returns: Array<Hash>
    def charge_codes
      get('/chargecode').map do |charge_code|
        {
          key: charge_code['ChargeCodeKey'],
          code: charge_code['Code'],
          description: charge_code['Description'],
          name: charge_code['Name']
        }
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tops_connect-0.7.2 lib/tops_connect/communities.rb
tops_connect-0.7.0 lib/tops_connect/communities.rb