Skip to content

Commit

Permalink
1.7.15 (#447)
Browse files Browse the repository at this point in the history
* add dst_number_min_length, dst_number_max_length to admin dialpeers API (refs #445)

* add dst_number_min_length, dst_number_max_length to admin destinations API
  • Loading branch information
dmitry-sinina authored Feb 27, 2019
1 parent fbae423 commit a104cb4
Show file tree
Hide file tree
Showing 10 changed files with 83 additions and 72 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ jobs:
- RAILS_ENV=test bundle exec rake db:create db:structure:load db:migrate
- RAILS_ENV=test bundle exec rake db:second_base:create db:second_base:structure:load db:second_base:migrate
- RAILS_ENV=test bundle exec rake db:seed
- cd pgq-processors && gem install bundler -v '< 2' && cd ..
- cd pgq-processors && bundle install --gemfile="./Gemfile" && cd ..
- cd pgq-processors && BUNDLE_GEMFILE=./Gemfile ./bin/bundle exec rspec && cd ..

Expand Down
52 changes: 27 additions & 25 deletions app/resources/api/rest/admin/destination_resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class Api::Rest::Admin::DestinationResource < JSONAPI::Resource
attributes :enabled, :next_rate, :connect_fee, :initial_interval, :next_interval, :dp_margin_fixed,
:dp_margin_percent, :initial_rate, :asr_limit, :acd_limit, :short_calls_limit,
:prefix, :reject_calls, :use_dp_intervals, :valid_from, :valid_till, :external_id,
:routing_tag_ids
:routing_tag_ids, :dst_number_min_length, :dst_number_max_length

has_one :rateplan
has_one :rate_policy, class_name: 'DestinationRatePolicy'
Expand All @@ -12,30 +12,32 @@ class Api::Rest::Admin::DestinationResource < JSONAPI::Resource

filters :external_id, :prefix, :rateplan_id

def self.updatable_fields(context)
[
:enabled,
:prefix,
:rateplan,
:next_rate,
:connect_fee,
:initial_interval,
:next_interval,
:dp_margin_fixed,
:dp_margin_percent,
:rate_policy,
:initial_rate,
:reject_calls,
:use_dp_intervals,
:valid_from,
:valid_till,
:profit_control_mode,
:routing_tag_mode,
:external_id,
:asr_limit,
:acd_limit,
:short_calls_limit,
:routing_tag_ids
def self.updatable_fields(_context)
%i[
enabled
prefix
rateplan
next_rate
connect_fee
initial_interval
next_interval
dp_margin_fixed
dp_margin_percent
rate_policy
initial_rate
reject_calls
use_dp_intervals
valid_from
valid_till
profit_control_mode
routing_tag_mode
external_id
asr_limit
acd_limit
short_calls_limit
routing_tag_ids
dst_number_min_length
dst_number_max_length
]
end

Expand Down
72 changes: 37 additions & 35 deletions app/resources/api/rest/admin/dialpeer_resource.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ class Api::Rest::Admin::DialpeerResource < JSONAPI::Resource
:prefix, :src_rewrite_rule, :dst_rewrite_rule, :acd_limit, :asr_limit, :src_rewrite_result,
:dst_rewrite_result, :locked, :priority, :exclusive_route, :capacity, :lcr_rate_multiplier,
:force_hit_rate, :network_prefix_id, :created_at, :short_calls_limit, :external_id,
:routing_tag_ids
:routing_tag_ids, :dst_number_min_length, :dst_number_max_length

has_one :gateway
has_one :gateway_group
Expand All @@ -17,40 +17,42 @@ class Api::Rest::Admin::DialpeerResource < JSONAPI::Resource

filters :external_id, :prefix, :routing_group_id

def self.updatable_fields(context)
[
:enabled,
:prefix,
:src_rewrite_rule,
:dst_rewrite_rule,
:acd_limit,
:asr_limit,
:gateway,
:routing_group,
:next_rate,
:connect_fee,
:vendor,
:account,
:routing_tag_mode,
:src_rewrite_result,
:dst_rewrite_result,
:locked,
:priority,
:exclusive_route,
:capacity,
:lcr_rate_multiplier,
:initial_rate,
:initial_interval,
:next_interval,
:valid_from,
:valid_till,
:gateway_group,
:force_hit_rate,
:network_prefix_id,
:created_at,
:short_calls_limit,
:external_id,
:routing_tag_ids
def self.updatable_fields(_context)
%i[
enabled
prefix
src_rewrite_rule
dst_rewrite_rule
acd_limit
asr_limit
gateway
routing_group
next_rate
connect_fee
vendor
account
routing_tag_mode
src_rewrite_result
dst_rewrite_result
locked
priority
exclusive_route
capacity
lcr_rate_multiplier
initial_rate
initial_interval
next_interval
valid_from
valid_till
gateway_group
force_hit_rate
network_prefix_id
created_at
short_calls_limit
external_id
routing_tag_ids
dst_number_min_length
dst_number_max_length
]
end

Expand Down
2 changes: 1 addition & 1 deletion ci/build_jessie.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ FROM debian:jessie

RUN apt-get update && apt-get -y dist-upgrade && apt-get -y --no-install-recommends install wget
RUN wget http://pkg.yeti-switch.org/key.gpg -O - | apt-key add -
RUN echo "deb http://pkg.yeti-switch.org/debian/jessie unstable main ext" >> /etc/apt/sources.list
RUN echo "deb http://pkg.yeti-switch.org/debian/jessie 1.7 main" >> /etc/apt/sources.list
RUN echo "deb http://deb.debian.org/debian buster main contrib non-free" >> /etc/apt/sources.list
RUN echo "Package: *\nPin: release n=buster\nPin-Priority: 50\n\nPackage: python-git python-gitdb python-smmap python-tzlocal\nPin: release n=buster\nPin-Priority: 500\n\n" | tee /etc/apt/preferences

Expand Down
2 changes: 1 addition & 1 deletion ci/build_stretch.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ FROM debian:stretch

RUN apt-get update && apt-get -y dist-upgrade && apt-get -y --no-install-recommends install wget gnupg
RUN wget http://pkg.yeti-switch.org/key.gpg -O - | apt-key add -
RUN echo "deb http://pkg.yeti-switch.org/debian/stretch unstable main ext" >> /etc/apt/sources.list
RUN echo "deb http://pkg.yeti-switch.org/debian/stretch 1.7 main" >> /etc/apt/sources.list
RUN echo "deb http://deb.debian.org/debian buster main contrib non-free" >> /etc/apt/sources.list
RUN echo "Package: *\nPin: release n=buster\nPin-Priority: 50\n\nPackage: python-git python-gitdb python-smmap python-tzlocal\nPin: release n=buster\nPin-Priority: 500\n\n" | tee /etc/apt/preferences

Expand Down
1 change: 0 additions & 1 deletion pgq-processors/Gemfile
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
source "http://rubygems.org"

gem 'rake'
gem 'bundler'
gem 'pgq', path: 'ext/pgq'
gem 'pg'
gem 'activeresource'
Expand Down
1 change: 0 additions & 1 deletion pgq-processors/Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ PLATFORMS
DEPENDENCIES
activeresource
activeresource-persistent
bundler
bunny
bunny-mock
byebug
Expand Down
2 changes: 1 addition & 1 deletion pgq-processors/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ all:

all_env:
@$(info:msg=PGQ: install bundler)
@gem install --install-dir vendor/bundler bundler
@gem install --install-dir vendor/bundler bundler -v '< 2'

@$(info:msg=PGQ: install gems)
@vendor/bundler/bin/bundle install --jobs=4 --frozen --deployment --binstubs
Expand Down
11 changes: 8 additions & 3 deletions spec/acceptance/rest/admin/api/destinations_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,14 @@
let(:auth_token) { ::Knock::AuthToken.new(payload: { sub: user.id }).token }
let(:type) { 'destinations' }

required_params = %i(
required_params = %i[
enabled next-rate connect-fee initial-interval next-interval dp-margin-fixed dp-margin-percent
initial-rate asr-limit acd-limit short-calls-limit
)
optional_params = %i(prefix reject-calls use-dp-intervals valid-from valid-till external-id routing-tag-ids)
]
optional_params = %i[
prefix reject-calls use-dp-intervals valid-from valid-till external-id routing-tag-ids
dst_number-min-length dst-number-max-length
]

required_relationships = %i(rateplan rate-policy)
optional_relationships = %i(profit-control-mode routing-tag-modes)
Expand Down Expand Up @@ -51,6 +54,8 @@
let(:'dp-margin-fixed') { 0 }
let(:'dp-margin-percent') { 0 }
let(:'rate-policy') { wrap_relationship(:'destination-rate-policies', 1) }
let(:'dst-number-min-length') { 0 }
let(:'dst-number-max-length') { 100 }

example_request 'create new entry' do
expect(status).to eq(201)
Expand Down
11 changes: 7 additions & 4 deletions spec/acceptance/rest/admin/api/dialpeers_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,16 @@
let(:auth_token) { ::Knock::AuthToken.new(payload: { sub: user.id }).token }
let(:type) { 'dialpeers' }

required_params = %i(
required_params = %i[
enabled next-rate connect-fee initial-rate initial-interval next-interval valid-from valid-till
)
]

optional_params = %i(
optional_params = %i[
prefix src-rewrite-rule dst-rewrite-rule acd-limit asr-limit src-rewrite-result
dst-rewrite-result locked priority exclusive-route capacity lcr-rate-multiplier
force-hit-rate network-prefix-id created-at short-calls-limit external-id routing-tag-ids
)
dst_number-min-length dst-number-max-length
]

required_relationships = %i(routing-group vendor account)
optional_relationships = %i(gateway gateway-group routing-tag-modes)
Expand Down Expand Up @@ -58,6 +59,8 @@
let(:'next-interval') { 60 }
let(:'initial-rate') { 0.0 }
let(:'next-rate') { 0.0 }
let(:'dst-number-min-length') { 0 }
let(:'dst-number-max-length') { 100 }

example_request 'create new entry' do
expect(status).to eq(201)
Expand Down

0 comments on commit a104cb4

Please sign in to comment.