Class: RHC::Rest::Mock::MockRestCartridge
Constant Summary
Constants inherited
from Cartridge
Cartridge::HIDDEN_TAGS
Instance Attribute Summary collapse
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 Cartridge
#<=>, #additional_gear_storage, #automatic_updates?, #collocated_with, #connection_info, #custom?, #display_name, #external?, for_url, #gear_storage, #only_in_existing?, #only_in_new?, #property, #scalable?, #scaling, #shares_gears?, #short_name, #tags, #url_basename, #usage_rate?
Methods inherited from Base
#add_message, #has_param?, #link_href, #links, #rest_method, #supports?
#define_attr, #model_name
Methods included from Attributes
#attribute, #attributes, #attributes=, #clear_attribute
Constructor Details
#initialize(client, name, type, app = nil, tags = [], properties = [{'type' => 'cart_data', 'name' => 'connection_url', 'value' => "http://fake.url" }], description = nil) ⇒ MockRestCartridge
Returns a new instance of MockRestCartridge.
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
|
# File 'lib/rhc/rest/mock.rb', line 1023
def initialize(client, name, type, app=nil, tags=[], properties=[{'type' => 'cart_data', 'name' => 'connection_url', 'value' => "http://fake.url" }], description=nil)
super({}, client)
@name = name
@description = description || "Description of #{name}"
@type = type
@app = app
@tags = tags
@properties = properties.each(&:stringify_keys!)
@status_messages = [{"message" => "started", "gear_id" => "123"}]
@scales_from = 1
@scales_to = 1
@current_scale = 1
@gear_profile = 'small'
@additional_gear_storage = 5
@usage_rate = 0.0
end
|
Instance Attribute Details
#usage_rate ⇒ Object
Returns the value of attribute usage_rate.
1021
1022
1023
|
# File 'lib/rhc/rest/mock.rb', line 1021
def usage_rate
@usage_rate
end
|
Instance Method Details
1040
1041
1042
|
# File 'lib/rhc/rest/mock.rb', line 1040
def destroy
@app.cartridges.delete self
end
|
1063
1064
1065
|
# File 'lib/rhc/rest/mock.rb', line 1063
def reload
@app
end
|
1058
1059
1060
1061
|
# File 'lib/rhc/rest/mock.rb', line 1058
def restart
@status_messages = [{"message" => "started", "gear_id" => "123"}]
@app
end
|
#set_scales(values) ⇒ Object
1067
1068
1069
1070
1071
1072
|
# File 'lib/rhc/rest/mock.rb', line 1067
def set_scales(values)
values.delete_if{|k,v| v.nil? }
@scales_from = values[:scales_from] if values[:scales_from]
@scales_to = values[:scales_to] if values[:scales_to]
self
end
|
#set_storage(values) ⇒ Object
1074
1075
1076
1077
|
# File 'lib/rhc/rest/mock.rb', line 1074
def set_storage(values)
@additional_gear_storage = values[:additional_gear_storage] if values[:additional_gear_storage]
self
end
|
1048
1049
1050
1051
|
# File 'lib/rhc/rest/mock.rb', line 1048
def start
@status_messages = [{"message" => "started", "gear_id" => "123"}]
@app
end
|
1044
1045
1046
|
# File 'lib/rhc/rest/mock.rb', line 1044
def status
@status_messages
end
|
1053
1054
1055
1056
|
# File 'lib/rhc/rest/mock.rb', line 1053
def stop
@status_messages = [{"message" => "stopped", "gear_id" => "123"}]
@app
end
|