Sha256: 139b96389320791e9f190a1e1cac4a5acd5761e08817a40fd3e1e4cb311c8555

Contents?: true

Size: 1.33 KB

Versions: 6

Compression:

Stored size: 1.33 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

6 entries across 6 versions & 1 rubygems

Version Path
oneaccess-1.2.0 lib/oneaccess/api/v1_1/references.rb
oneaccess-1.1.0 lib/oneaccess/api/v1_1/references.rb
oneaccess-1.0.1 lib/oneaccess/api/v1_1/references.rb
oneaccess-1.0.0 lib/oneaccess/api/v1_1/references.rb
oneaccess-0.5.0 lib/oneaccess/api/v1_1/references.rb
oneaccess-0.4.5 lib/oneaccess/api/v1_1/references.rb