Sha256: e4805c17d1841bd09c5bffbd79722326c4a4503b48e253a273621f28a8d1b94f

Contents?: true

Size: 1.24 KB

Versions: 3

Compression:

Stored size: 1.24 KB

Contents

module Nucleus
  module Adapters
    module V1
      class OpenshiftV2 < Stub
        module Domains
          # @see Stub#domains
          def domains(application_id)
            domains = get("/application/#{app_id_by_name(application_id)}/aliases").body[:data]
            domains.collect { |domain| to_nucleus_domain(domain) }
          end

          # @see Stub#domain
          def domain(application_id, domain_id)
            to_nucleus_domain get("/application/#{app_id_by_name(application_id)}/alias/#{domain_id}").body[:data]
          end

          # @see Stub#create_domain
          def create_domain(application_id, domain_entity)
            to_nucleus_domain post("/application/#{app_id_by_name(application_id)}/aliases",
                                   body: { id: domain_entity[:name] }).body[:data]
          end

          # @see Stub#delete_domain
          def delete_domain(application_id, domain_id)
            delete("/application/#{app_id_by_name(application_id)}/alias/#{domain_id}")
          end

          private

          def to_nucleus_domain(domain)
            { id: domain[:id], name: domain[:id], created_at: nil, updated_at: nil }
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
nucleus-0.3.1 lib/nucleus/adapters/v1/openshift_v2/domains.rb
nucleus-0.2.0 lib/nucleus/adapters/v1/openshift_v2/domains.rb
nucleus-0.1.0 lib/nucleus/adapters/v1/openshift_v2/domains.rb