Sha256: f04c0aadcf1d594684597eb038a2e99a202c8d9e6dd1178132d75eaf09b02bb7

Contents?: true

Size: 1.34 KB

Versions: 2

Compression:

Stored size: 1.34 KB

Contents

# frozen_string_literal: true

require_relative '../../response/industries_response'
require_relative '../../response/countries_response'
require_relative '../../response/contributors_response'

module ONEAccess
  module API
    module V1_1
      class References < Base
        api_path '/references'

        class << self
          def industries(sort_by: 'Id', is_ascending: false, keyword: '', page_number: 0, page_size: 20)
            query = build_query(sort_by, is_ascending, keyword, page_number, page_size)

            resp = send_get('industries', Query: query.to_json)

            Response::IndustriesResponse.from_json(resp.body)
          end

          def countries(sort_by: 'Id', is_ascending: false, keyword: '', page_number: 0, page_size: 20)
            query = build_query(sort_by, is_ascending, keyword, page_number, page_size)

            resp = send_get('countries', Query: query.to_json)

            Response::CountriesResponse.from_json(resp.body)
          end

          private

          def build_query(sort_by, is_ascending, keyword, page_number, page_size)
            {
              SortBy:      sort_by,
              IsAscending: is_ascending,
              Keyword:     keyword,
              PageNumber:  page_number,
              PageSize:    page_size,
            }
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
oneaccess-1.3.1 lib/oneaccess/api/v1_1/references.rb
oneaccess-1.3.0 lib/oneaccess/api/v1_1/references.rb