Sha256: ed9a677d7cd701d5da0a52b3586a295feb0bd0ada18c24cb7b0ebdd88b000f8c

Contents?: true

Size: 1.17 KB

Versions: 1

Compression:

Stored size: 1.17 KB

Contents

module Xolphin
  module Api
    module Endpoint
      class Support
        def initialize(http)
          @http = http
        end

        def products
          products = []

          result = @http.get("/products", page: 1)
          response = Xolphin::Api::Responses::Products.new(result)

          unless response.error?
            products = response.products
            while response.page < response.pages
              result = @http.get("/products", page: response.page + 1)
              response = Xolphin::Api::Responses::Products.new(result)
              break if response.error?

              products += response.products
            end
          end

          products
        end

        def product(id)
          result = @http.get("/products/#{id}")

          Xolphin::Api::Responses::Product.new(result)
        end

        def decode_csr(csr)
          result = @http.post("/decode-csr", csr: csr)

          Xolphin::Api::Responses::CsrData.new(result)
        end

        def approver_email_addresses(domain)
          @http.get("/approver-email-addresses", domain: domain)
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
xolphin-api-1.5.0 lib/xolphin/api/endpoint/support.rb