Class: RHC::Rest::Mock::MockRestAlias

Inherits:
Alias show all
Includes:
Helpers
Defined in:
lib/rhc/rest/mock.rb

Instance Method Summary collapse

Methods included from Helpers

#challenge, #credentials_for, #define_exceptional_test_on_wizard, #empty_domains, #empty_keys, #empty_response_list, #example_allows_gear_sizes?, #example_allows_members?, #expect_authorization, #mock_alias_links, #mock_alias_response, #mock_api_with_authorizations, #mock_app_links, #mock_cart_links, #mock_cartridge_response, #mock_client_links, #mock_date_1, #mock_domain_links, #mock_gear_groups_response, #mock_href, #mock_key_links, #mock_pass, #mock_real_client_links, #mock_response_links, #mock_team_links, #mock_teams_links, #mock_uri, #mock_user, #mock_user_auth, #mock_user_links, #new_authorization, #new_domain, #simple_carts, #simple_user, #stub_add_authorization, #stub_add_key, #stub_add_key_error, #stub_api, #stub_api_request, #stub_api_v12, #stub_application_cartridges, #stub_authorizations, #stub_create_domain, #stub_delete_authorization, #stub_delete_authorizations, #stub_mock_ssh_keys, #stub_no_domains, #stub_no_keys, #stub_one_application, #stub_one_domain, #stub_one_key, #stub_relative_application, #stub_simple_carts, #stub_update_key, #stub_user

Methods inherited from Alias

#<=>, #has_private_ssl_certificate?, #to_s

Methods inherited from Base

#add_message, #has_param?, #link_href, #links, #rest_method, #supports?

Methods included from AttributesClass

#define_attr, #model_name

Methods included from Attributes

#attribute, #attributes, #attributes=, #clear_attribute

Constructor Details

#initialize(client, id, has_private_ssl_certificate = false, certificate_added_at = nil) ⇒ MockRestAlias

Returns a new instance of MockRestAlias.



794
795
796
797
798
799
# File 'lib/rhc/rest/mock.rb', line 794

def initialize(client, id, has_private_ssl_certificate=false, certificate_added_at=nil)
  super({}, client)
  @id = id
  @has_private_ssl_certificate = has_private_ssl_certificate
  @certificate_added_at = certificate_added_at
end

Instance Method Details

#add_certificate(ssl_certificate_content, private_key_content, pass_phrase) ⇒ Object



801
802
803
804
805
806
807
808
# File 'lib/rhc/rest/mock.rb', line 801

def add_certificate(ssl_certificate_content, private_key_content, pass_phrase)
  if (client.api_version_negotiated >= 1.4)
    @has_private_ssl_certificate = true
    @certificate_added_at = Time.now
  else
    raise RHC::Rest::SslCertificatesNotSupported, "The server does not support SSL certificates for custom aliases."
  end
end

#delete_certificateObject



810
811
812
813
814
815
816
817
# File 'lib/rhc/rest/mock.rb', line 810

def delete_certificate
  if (client.api_version_negotiated >= 1.4)
    @has_private_ssl_certificate = false
    @certificate_added_at = nil
  else
    raise RHC::Rest::SslCertificatesNotSupported, "The server does not support SSL certificates for custom aliases."
  end
end

#destroyObject



819
820
821
822
823
# File 'lib/rhc/rest/mock.rb', line 819

def destroy
  puts @application.inspect
  puts self.inspect
  @application.aliases.delete self
end