diff --git a/app/admin/equipment/gateways.rb b/app/admin/equipment/gateways.rb index 17f36714d..66c632b32 100644 --- a/app/admin/equipment/gateways.rb +++ b/app/admin/equipment/gateways.rb @@ -640,6 +640,8 @@ def resource_params end if s.allow_termination? end + + active_admin_comments end sidebar :links, only: [:show, :edit] do diff --git a/app/admin/equipment/lnp_database.rb b/app/admin/equipment/lnp_database.rb index 99345f141..251a9986e 100644 --- a/app/admin/equipment/lnp_database.rb +++ b/app/admin/equipment/lnp_database.rb @@ -14,7 +14,7 @@ member_action :test, method: :post do begin - lrn=Lnp::Database.find(resource) + lrn=Lnp::Database.find(resource.id) r=lrn.test_db(params['dst']['dst']) if lrn.present? flash[:notice] = "Database: #{lrn.name} Destination: #{params['dst']['dst']} LRN: #{r.lrn}, TAG: #{r.tag}" rescue StandardError => e diff --git a/app/admin/routing/destinations.rb b/app/admin/routing/destinations.rb index 57473b8c4..f38c4aadc 100644 --- a/app/admin/routing/destinations.rb +++ b/app/admin/routing/destinations.rb @@ -14,7 +14,7 @@ { enabled: boolean_select, prefix: 'text', - routing_tag_mode: Routing::RoutingTag.pluck(:name, :id), + routing_tag_mode_id: Routing::RoutingTagMode.pluck(:name,:id), reject_calls: boolean_select, quality_alarm: boolean_select, rateplan_id: Rateplan.pluck(:name, :id), diff --git a/app/admin/routing/dialpeers.rb b/app/admin/routing/dialpeers.rb index c8c36e93b..b1d657a4f 100644 --- a/app/admin/routing/dialpeers.rb +++ b/app/admin/routing/dialpeers.rb @@ -17,7 +17,7 @@ { enabled: boolean_select, prefix: 'text', - routing_tag_mode: Routing::RoutingTag.pluck(:name, :id), + routing_tag_mode_id: Routing::RoutingTagMode.pluck(:name,:id), routing_group_id: RoutingGroup.pluck(:name, :id), priority: 'text', force_hit_rate: 'text', diff --git a/app/resources/api/rest/admin/account_resource.rb b/app/resources/api/rest/admin/account_resource.rb index f23bcaa00..bc49c15fd 100644 --- a/app/resources/api/rest/admin/account_resource.rb +++ b/app/resources/api/rest/admin/account_resource.rb @@ -1,6 +1,8 @@ class Api::Rest::Admin::AccountResource < ::BaseResource - attributes :name, :min_balance, :max_balance, :external_id, + attributes :name, + :balance, :min_balance, :max_balance, :balance_low_threshold, :balance_high_threshold, :send_balance_notifications_to, + :external_id, :uuid, :origination_capacity, :termination_capacity, :send_invoices_to has_one :contractor @@ -24,6 +26,8 @@ def send_balance_notifications_to=(value) def self.updatable_fields(_context) [ :name, + :uuid, + :external_id, :min_balance, :max_balance, :balance_low_threshold, diff --git a/spec/controllers/api/rest/admin/accounts_controller_spec.rb b/spec/controllers/api/rest/admin/accounts_controller_spec.rb index 815c93837..f1e3d4025 100755 --- a/spec/controllers/api/rest/admin/accounts_controller_spec.rb +++ b/spec/controllers/api/rest/admin/accounts_controller_spec.rb @@ -37,9 +37,15 @@ it { expect(response_data['id']).to eq(account.id.to_s) } it 'has balance threshold attributes' do expect(response_data['attributes']).to include( + 'name', + 'balance','min-balance', 'max-balance', + 'uuid', + 'external-id', + 'origination-capacity', 'termination-capacity', 'send-invoices-to', 'balance-low-threshold', 'balance-high-threshold', - 'send-balance-notifications-to') + 'send-balance-notifications-to' + ) end end @@ -63,13 +69,17 @@ context 'when attributes are valid' do let(:attributes) do { - name: 'name', + name: 'name', 'min-balance': 1, 'external-id': 100, + 'uuid': '29161666-c29c-11e8-a11d-a088b4454590', 'max-balance': 10, 'balance-low-threshold': 90, 'balance-high-threshold': 95, - 'send-balance-notifications-to': Array.wrap(Billing::Contact.collection.first.id) + 'send-balance-notifications-to': Array.wrap(Billing::Contact.collection.first.id), + 'send-invoices-to': Billing::Contact.collection.first.id, + 'origination-capacity': 10, + 'termination-capacity': 3 } end @@ -106,10 +116,16 @@ let(:attributes) do { name: 'name', + 'external-id': 110, + 'uuid': '5d24297a-c29c-11e8-a11d-a088b4454590', + 'min-balance': -100, + 'max-balance': 100, 'balance-low-threshold': 90, 'balance-high-threshold': 95, 'send-balance-notifications-to': Billing::Contact.collection.first.id, - 'send-invoices-to': Billing::Contact.collection.first.id + 'send-invoices-to': Billing::Contact.collection.first.id, + 'origination-capacity': 10, + 'termination-capacity': 3 } end @@ -125,10 +141,10 @@ end context 'when attributes are not updatable' do - let(:attributes) { { 'external-id': 200 } } + let(:attributes) { { 'balance': 2100.2 } } it { expect(response.status).to eq(400) } - it { expect(account.reload.external_id).to_not eq(200) } + it { expect(account.reload.external_id).to_not eq(2100.2) } end end