Class: Ari::Endpoint
- Defined in:
- lib/ari/resources/endpoint.rb
Instance Attribute Summary collapse
-
#channel_ids ⇒ Object
readonly
Returns the value of attribute channel_ids.
-
#resource ⇒ Object
readonly
Returns the value of attribute resource.
-
#state ⇒ Object
readonly
Returns the value of attribute state.
-
#technology ⇒ Object
readonly
Returns the value of attribute technology.
Class Method Summary collapse
-
.get(options = {}) ⇒ Object
GET /endpoints/%tech/%#resource.
-
.list(options = {}) ⇒ Object
GET /endpoints.
-
.list_by_tech(options = {}) ⇒ Object
GET /endpoints/%tech.
-
.listByTech ⇒ Object
GET /endpoints/%tech.
-
.send_message(options = {}) ⇒ Object
(also: sendMessage)
PUT /endpoints/sendMessage.
-
.send_message_to_endpoint(options = {}) ⇒ Object
PUT /endpoints/%tech/%#resource/sendMessage.
-
.sendMessageToEndpoint ⇒ Object
PUT /endpoints/%tech/%#resource/sendMessage.
Instance Method Summary collapse
- #get(options = {}) ⇒ Object
- #list_by_tech(options = {}) ⇒ Object
- #send_message_to_endpoint(options = {}) ⇒ Object
Methods inherited from Resource
#add_listener, client, #client, #remove_all_listeners!, #remove_listener
Methods inherited from Model
Constructor Details
This class inherits a constructor from Ari::Model
Instance Attribute Details
#channel_ids ⇒ Object (readonly)
Returns the value of attribute channel_ids.
15 16 17 |
# File 'lib/ari/resources/endpoint.rb', line 15 def channel_ids @channel_ids end |
#resource ⇒ Object (readonly)
Returns the value of attribute resource.
15 16 17 |
# File 'lib/ari/resources/endpoint.rb', line 15 def resource @resource end |
#state ⇒ Object (readonly)
Returns the value of attribute state.
15 16 17 |
# File 'lib/ari/resources/endpoint.rb', line 15 def state @state end |
#technology ⇒ Object (readonly)
Returns the value of attribute technology.
15 16 17 |
# File 'lib/ari/resources/endpoint.rb', line 15 def technology @technology end |
Class Method Details
.get(options = {}) ⇒ Object
GET /endpoints/%tech/%#resource
Single endpoint
Parameters:
tech (required) - Technology of the endpoint resource (required) - ID of the endpoint
80 81 82 83 84 85 86 |
# File 'lib/ari/resources/endpoint.rb', line 80 def self.get( = {}) raise ArgumentError.new("Parameter tech must be passed in options hash.") unless [:tech] raise ArgumentError.new("Parameter resource must be passed in options hash.") unless [:resource] path = '/endpoints/%{tech}/%{resource}' % response = client().get(path, ) Endpoint.new(response.merge(client: [:client])) end |
.list(options = {}) ⇒ Object
GET /endpoints
Asterisk endpoints
23 24 25 26 27 |
# File 'lib/ari/resources/endpoint.rb', line 23 def self.list( = {}) path = '/endpoints' response = client().get(path, ) response.map { |hash| Endpoint.new(hash.merge(client: [:client])) } end |
.list_by_tech(options = {}) ⇒ Object
GET /endpoints/%tech
Asterisk endpoints
Parameters:
tech (required) - Technology of the endpoints (sip,iax2,…)
58 59 60 61 62 63 |
# File 'lib/ari/resources/endpoint.rb', line 58 def self.list_by_tech( = {}) raise ArgumentError.new("Parameter tech must be passed in options hash.") unless [:tech] path = '/endpoints/%{tech}' % response = client().get(path, ) response.map { |hash| Endpoint.new(hash.merge(client: [:client])) } end |
.listByTech ⇒ Object
GET /endpoints/%tech
Asterisk endpoints
Parameters:
tech (required) - Technology of the endpoints (sip,iax2,…)
64 65 66 67 68 69 |
# File 'lib/ari/resources/endpoint.rb', line 64 def self.list_by_tech( = {}) raise ArgumentError.new("Parameter tech must be passed in options hash.") unless [:tech] path = '/endpoints/%{tech}' % response = client().get(path, ) response.map { |hash| Endpoint.new(hash.merge(client: [:client])) } end |
.send_message(options = {}) ⇒ Object Also known as: sendMessage
PUT /endpoints/sendMessage
Send a message to some technology URI or endpoint.
Parameters:
to (required) - The endpoint resource or technology specific URI to send the message to. Valid resources are sip, pjsip, and xmpp. from (required) - The endpoint resource or technology specific identity to send this message from. Valid resources are sip, pjsip, and xmpp. body - The body of the message variables -
41 42 43 44 45 46 |
# File 'lib/ari/resources/endpoint.rb', line 41 def self.( = {}) raise ArgumentError.new("Parameter to must be passed in options hash.") unless [:to] raise ArgumentError.new("Parameter from must be passed in options hash.") unless [:from] path = '/endpoints/sendMessage' response = client().put(path, ) end |
.send_message_to_endpoint(options = {}) ⇒ Object
PUT /endpoints/%tech/%#resource/sendMessage
Send a message to some endpoint in a technology.
Parameters:
tech (required) - Technology of the endpoint resource (required) - ID of the endpoint from (required) - The endpoint resource or technology specific identity to send this message from. Valid resources are sip, pjsip, and xmpp. body - The body of the message variables -
105 106 107 108 109 110 111 |
# File 'lib/ari/resources/endpoint.rb', line 105 def self.( = {}) raise ArgumentError.new("Parameter tech must be passed in options hash.") unless [:tech] raise ArgumentError.new("Parameter resource must be passed in options hash.") unless [:resource] raise ArgumentError.new("Parameter from must be passed in options hash.") unless [:from] path = '/endpoints/%{tech}/%{resource}/sendMessage' % response = client().put(path, ) end |
.sendMessageToEndpoint ⇒ Object
PUT /endpoints/%tech/%#resource/sendMessage
Send a message to some endpoint in a technology.
Parameters:
tech (required) - Technology of the endpoint resource (required) - ID of the endpoint from (required) - The endpoint resource or technology specific identity to send this message from. Valid resources are sip, pjsip, and xmpp. body - The body of the message variables -
112 113 114 115 116 117 118 |
# File 'lib/ari/resources/endpoint.rb', line 112 def self.( = {}) raise ArgumentError.new("Parameter tech must be passed in options hash.") unless [:tech] raise ArgumentError.new("Parameter resource must be passed in options hash.") unless [:resource] raise ArgumentError.new("Parameter from must be passed in options hash.") unless [:from] path = '/endpoints/%{tech}/%{resource}/sendMessage' % response = client().put(path, ) end |
Instance Method Details
#get(options = {}) ⇒ Object
88 89 90 |
# File 'lib/ari/resources/endpoint.rb', line 88 def get( = {}) self.class.get(.merge(endpointId: self.id, client: @client)) end |
#list_by_tech(options = {}) ⇒ Object
66 67 68 |
# File 'lib/ari/resources/endpoint.rb', line 66 def list_by_tech( = {}) self.class.list_by_tech(.merge(endpointId: self.id, client: @client)) end |
#send_message_to_endpoint(options = {}) ⇒ Object
114 115 116 |
# File 'lib/ari/resources/endpoint.rb', line 114 def ( = {}) self.class.(.merge(endpointId: self.id, client: @client)) end |