Sha256: fb08bdadcba75f73cb6e2d0ce2dc891e5524ec6eabbdf8b58d091d92678c2f34

Contents?: true

Size: 1.38 KB

Versions: 7

Compression:

Stored size: 1.38 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 # rubocop:disable Style/ClassAndModuleCamelCase
      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

7 entries across 7 versions & 1 rubygems

Version Path
oneaccess-0.4.4 lib/oneaccess/api/v1_1/references.rb
oneaccess-0.4.3 lib/oneaccess/api/v1_1/references.rb
oneaccess-0.4.2 lib/oneaccess/api/v1_1/references.rb
oneaccess-0.4.1 lib/oneaccess/api/v1_1/references.rb
oneaccess-0.4.0 lib/oneaccess/api/v1_1/references.rb
oneaccess-0.3.0 lib/oneaccess/api/v1_1/references.rb
oneaccess-0.2.0 lib/oneaccess/api/v1_1/references.rb