-
Notifications
You must be signed in to change notification settings - Fork 11
VAPI-3162-REFER #211
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
atelegu
wants to merge
18
commits into
main
Choose a base branch
from
VAPI-3162-REFER
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
VAPI-3162-REFER #211
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
3961094
VAPI-3162-REFER
atelegu 63d9927
VAPI-3162-REFER
atelegu 06f9afb
VAPI-3162-REFER
atelegu 75fc16f
VAPI-3162-REFER
atelegu 51c8b79
VAPI-3162-REFER
atelegu 9d29700
VAPI-3162-REFER
atelegu b54f869
VAPI-3162-REFER
atelegu 539a192
VAPI-3162-REFER
atelegu d33a62a
VAPI-3162-REFER
atelegu be3de02
Merge branch 'main' into VAPI-3162-REFER
atelegu c367380
VAPI-3162-REFER
atelegu cbcfb9c
Merge remote-tracking branch 'origin/VAPI-3162-REFER' into VAPI-3162-…
atelegu 9630fe1
VAPI-3162-REFER
atelegu d4618a0
Remove ReferCompleteCallback model, keep only Bxml::Refer verb
stampercasey 09845f7
Merge branch 'main' into VAPI-3162-REFER
stampercasey 7595660
Remove orphaned SipUri REST model and stale generator manifest entries
stampercasey f9e1687
Merge remote-tracking branch 'origin/VAPI-3162-REFER' into VAPI-3162-…
stampercasey dcf2409
Address review feedback: sip_uri defaults, set_sip_uri setter, annota…
stampercasey File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| module Bandwidth | ||
| module Bxml | ||
| class Refer < Bandwidth::Bxml::NestableVerb | ||
| # Initializer | ||
| # @param sip_uri [SipUri] The SIP URI to REFER the call to. Uses the same SipUri verb shared with Transfer. Defaults to an empty array. | ||
| # @param attributes [Hash] The attributes to add to the element. Defaults to an empty hash. | ||
| def initialize(sip_uri = [], attributes = {}) | ||
| super('Refer', nil, sip_uri, attributes) | ||
|
|
||
| @attribute_map = { | ||
| refer_complete_url: 'referCompleteUrl', # Optional [String]: URL to send the Refer Complete event to and request new BXML for failure recovery. May be a relative URL. Defaults to None. | ||
| refer_complete_method: 'referCompleteMethod', # Optional [String]: The HTTP method to use for the request to referCompleteUrl. GET or POST. Default value is POST. Defaults to None. | ||
| tag: 'tag', # Optional [String]: A custom string that will be sent with this and all future callbacks unless overwritten by a future tag attribute or cleared. May be cleared by setting tag="". Max length 256 characters. Defaults to None. | ||
| } | ||
| end | ||
|
|
||
| # Set the SIP URI destination for this Refer verb | ||
| # @param sip_uri [SipUri] The SIP URI to refer the call to. | ||
| def set_sip_uri(sip_uri) | ||
| @nested_verbs = [sip_uri] | ||
| end | ||
| end | ||
| end | ||
| end | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| # Unit tests for Bandwidth::Bxml::Refer | ||
| describe 'Bandwidth::Bxml::Refer' do | ||
| let(:initial_attributes) { | ||
| { | ||
| refer_complete_url: 'https://initial.com', | ||
| refer_complete_method: 'POST', | ||
| tag: 'initial_tag' | ||
| } | ||
| } | ||
|
|
||
| let(:new_attributes) { | ||
| { | ||
| refer_complete_url: 'https://new.com', | ||
| refer_complete_method: 'GET', | ||
| tag: 'new_tag' | ||
| } | ||
| } | ||
|
|
||
| let(:sip_uri) { Bandwidth::Bxml::SipUri.new('sip:alice@atlanta.example.com') } | ||
|
|
||
| let(:instance) { Bandwidth::Bxml::Refer.new([], initial_attributes) } | ||
| let(:instance_nested) { Bandwidth::Bxml::Refer.new(sip_uri, initial_attributes) } | ||
|
|
||
| describe 'test an instance of Refer' do | ||
| it 'validates instance of Refer' do | ||
| expect(instance).to be_instance_of(Bandwidth::Bxml::Refer) | ||
| expect(instance).to be_a(Bandwidth::Bxml::Verb) | ||
| end | ||
|
|
||
| it 'tests the set_attributes method of the Refer instance' do | ||
| instance.set_attributes(new_attributes) | ||
| expected = "\n<Refer referCompleteUrl=\"https://new.com\" referCompleteMethod=\"GET\" tag=\"new_tag\"/>\n" | ||
| expect(instance.to_bxml).to eq(expected) | ||
| end | ||
|
|
||
| it 'tests the set_sip_uri method of the Refer instance' do | ||
| instance.set_sip_uri(sip_uri) | ||
| expected = "\n<Refer referCompleteUrl=\"https://initial.com\" referCompleteMethod=\"POST\" tag=\"initial_tag\">\n <SipUri>sip:alice@atlanta.example.com</SipUri>\n</Refer>\n" | ||
| expect(instance.to_bxml).to eq(expected) | ||
| end | ||
| end | ||
|
|
||
| describe 'test an instance of Refer with a nested SipUri' do | ||
| it 'validates instance of Refer' do | ||
| expect(instance_nested).to be_instance_of(Bandwidth::Bxml::Refer) | ||
| expect(instance_nested).to be_a(Bandwidth::Bxml::Verb) | ||
| end | ||
|
|
||
| it 'tests the to_bxml method of the nested Refer instance' do | ||
| expected = "\n<Refer referCompleteUrl=\"https://initial.com\" referCompleteMethod=\"POST\" tag=\"initial_tag\">\n <SipUri>sip:alice@atlanta.example.com</SipUri>\n</Refer>\n" | ||
| expect(instance_nested.to_bxml).to eq(expected) | ||
| end | ||
| end | ||
| end |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
other nestable verbs have functions to update their nested verbs, we should add one here. It doesn't need to match the others in the way they append to the list, it can probably just set
@nested_verbsto an array of supplied SipUri.