Class: KillBillClient::Model::Tenant
- Inherits:
-
TenantAttributes
- Object
- Resource
- TenantAttributes
- KillBillClient::Model::Tenant
- Defined in:
- lib/killbill_client/models/tenant.rb
Constant Summary collapse
- KILLBILL_API_TENANTS_PREFIX =
"#{KILLBILL_API_PREFIX}/tenants"
Class Method Summary collapse
- .delete_tenant_key_value(key_name, key_path, error_id_str, user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
- .delete_tenant_plugin_config(plugin_name, user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
- .delete_tenant_user_key_value(key_name, user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
- .find_by_api_key(api_key, options = {}) ⇒ Object
- .find_by_id(tenant_id, options = {}) ⇒ Object
- .get_tenant_key_value(key_name, key_path, error_id_str, options = {}) ⇒ Object
- .get_tenant_plugin_config(plugin_name, options = {}) ⇒ Object
- .get_tenant_user_key_value(key_name, options = {}) ⇒ Object
- .search_tenant_config(key_prefix, options = {}) ⇒ Object
- .upload_tenant_key_value(key_name, key_value, key_path, get_method, error_id_str, user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
- .upload_tenant_plugin_config(plugin_name, plugin_config, user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
- .upload_tenant_user_key_value(key_name, key_value, user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
Instance Method Summary collapse
Class Method Details
.delete_tenant_key_value(key_name, key_path, error_id_str, user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/killbill_client/models/tenant.rb', line 91 def delete_tenant_key_value(key_name, key_path, error_id_str, user = nil, reason = nil, comment = nil, = {}) (, "Deleting a #{error_id_str} is only supported in multi-tenant mode") uri = KILLBILL_API_TENANTS_PREFIX + "/#{key_path}/" + key_name delete uri, {}, { }, { :content_type => 'text/plain', :user => user, :reason => reason, :comment => comment, }.merge() end |
.delete_tenant_plugin_config(plugin_name, user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
29 30 31 |
# File 'lib/killbill_client/models/tenant.rb', line 29 def delete_tenant_plugin_config(plugin_name, user = nil, reason = nil, comment = nil, = {}) delete_tenant_key_value(plugin_name, "uploadPluginConfig", "plugin config", user, reason, comment, ) end |
.delete_tenant_user_key_value(key_name, user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
42 43 44 |
# File 'lib/killbill_client/models/tenant.rb', line 42 def delete_tenant_user_key_value(key_name, user = nil, reason = nil, comment = nil, = {}) delete_tenant_key_value(key_name, "userKeyValue", "tenant key/value", user, reason, comment, ) end |
.find_by_api_key(api_key, options = {}) ⇒ Object
15 16 17 18 19 |
# File 'lib/killbill_client/models/tenant.rb', line 15 def find_by_api_key(api_key, = {}) get "#{KILLBILL_API_TENANTS_PREFIX}/?apiKey=#{api_key}", {}, end |
.find_by_id(tenant_id, options = {}) ⇒ Object
9 10 11 12 13 |
# File 'lib/killbill_client/models/tenant.rb', line 9 def find_by_id(tenant_id, = {}) get "#{KILLBILL_API_TENANTS_PREFIX}/#{tenant_id}", {}, end |
.get_tenant_key_value(key_name, key_path, error_id_str, options = {}) ⇒ Object
59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/killbill_client/models/tenant.rb', line 59 def get_tenant_key_value(key_name, key_path, error_id_str, = {}) (, "Retrieving a #{error_id_str} is only supported in multi-tenant mode") uri = KILLBILL_API_TENANTS_PREFIX + "/#{key_path}/" + key_name get uri, {}, { }.merge(), KillBillClient::Model::TenantKeyValueAttributes end |
.get_tenant_plugin_config(plugin_name, options = {}) ⇒ Object
21 22 23 |
# File 'lib/killbill_client/models/tenant.rb', line 21 def get_tenant_plugin_config(plugin_name, = {}) get_tenant_key_value(plugin_name, "uploadPluginConfig", "plugin config", ) end |
.get_tenant_user_key_value(key_name, options = {}) ⇒ Object
33 34 35 |
# File 'lib/killbill_client/models/tenant.rb', line 33 def get_tenant_user_key_value(key_name, = {}) get_tenant_key_value(key_name, "userKeyValue", "tenant key/value", ) end |
.search_tenant_config(key_prefix, options = {}) ⇒ Object
46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/killbill_client/models/tenant.rb', line 46 def search_tenant_config(key_prefix, = {}) (, "Searching for plugin config is only supported in multi-tenant mode") uri = KILLBILL_API_TENANTS_PREFIX + "/uploadPerTenantConfig/" + key_prefix + "/search" get uri, {}, { }.merge(), KillBillClient::Model::TenantKeyValueAttributes end |
.upload_tenant_key_value(key_name, key_value, key_path, get_method, error_id_str, user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/killbill_client/models/tenant.rb', line 72 def upload_tenant_key_value(key_name, key_value, key_path, get_method, error_id_str, user = nil, reason = nil, comment = nil, = {}) (, "Uploading a #{error_id_str} is only supported in multi-tenant mode") uri = KILLBILL_API_TENANTS_PREFIX + "/#{key_path}/" + key_name post uri, key_value, { }, { :content_type => 'text/plain', :user => user, :reason => reason, :comment => comment, }.merge() send(get_method.to_sym, key_name, ) end |
.upload_tenant_plugin_config(plugin_name, plugin_config, user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
25 26 27 |
# File 'lib/killbill_client/models/tenant.rb', line 25 def upload_tenant_plugin_config(plugin_name, plugin_config, user = nil, reason = nil, comment = nil, = {}) upload_tenant_key_value(plugin_name, plugin_config, "uploadPluginConfig", "get_tenant_plugin_config", "plugin config", user, reason, comment, ) end |
.upload_tenant_user_key_value(key_name, key_value, user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
37 38 39 |
# File 'lib/killbill_client/models/tenant.rb', line 37 def upload_tenant_user_key_value(key_name, key_value, user = nil, reason = nil, comment = nil, = {}) upload_tenant_key_value(key_name, key_value, "userKeyValue", "get_tenant_user_key_value", "tenant key/value", user, reason, comment, ) end |
Instance Method Details
#create(use_global_default = true, user = nil, reason = nil, comment = nil, options = {}) ⇒ Object
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 |
# File 'lib/killbill_client/models/tenant.rb', line 111 def create(use_global_default=true, user = nil, reason = nil, comment = nil, = {}) created_tenant = self.class.post KILLBILL_API_TENANTS_PREFIX, to_json, {:useGlobalDefault => use_global_default}, { :user => user, :reason => reason, :comment => comment, }.merge() # # Specify api_key and api_secret before making the call to retrieve the tenant object # otherwise that would fail with a 401 # [:api_key] = @api_key [:api_secret] = @api_secret created_tenant.refresh() end |