@@ -20,17 +20,37 @@ class Ata < Resource
2020 # @return [String] The domain for the ATA.
2121 # @!attribute domain
2222
23+ # @return [String] The user agent for the ATA.
24+ # @!attribute user_agent
25+
26+ # @return [String] The SIP URI for the ATA.
27+ # @!attribute sip_uri
28+
2329 # @return [String] The mac address for the ATA.
2430 # @!attribute mac_address
2531
32+ # @return [String] The name of the group which the ATA belongs to.
33+ # @!attribute group
34+
2635 # @return [String] The username for the ATA.
27- # @!attribute uername
36+ # @!attribute username
2837
2938 # @return [String] The password for the ATA.
3039 # @!attribute password
3140
3241 has_normal_attributes %w[
33- id name description user_phone_number domain username password mac_address
42+ id name description user_phone_number domain user_agent sip_uri
43+ mac_address group username password
44+ ]
45+
46+ # @return [Time] The time at which the ATA was last registered.
47+ # @!attribute last_registered
48+
49+ # @return [Time] The time at which the ATA's registration expires.
50+ # @!attribute expiry_time
51+
52+ has_time_attributes %w[
53+ last_registered expiry_time
3454 ]
3555
3656 # A reference to an ATA. This is returned by certain actions which don't
@@ -44,28 +64,48 @@ def to_i
4464 id
4565 end
4666
67+ # Gets the referenced ATA.
68+ # @return [Phaxio::Resources::ATA]
69+ def get
70+ Ata . get self
71+ end
72+ alias :retrieve :get
73+ alias :find :get
74+
4775 private
4876
4977 def initialize id
5078 self . id = id
5179 end
5280 end
5381
54- # A reference to a phone number, returned by ATA phone number management
55- # actions.
56- class PhoneNumberReference
57- # @return [String]
58- # The phone number.
59- attr_accessor :phone_number
82+ # A set of provisioning URLs.
83+ class ProvisioningURLs
84+ # @return [Hash<String: String>] The hash of provisioning URLs.
85+ # @!attribute urls
86+ attr_reader :urls
87+
88+ GRANDSTREAM = 'Grandstream'
89+ OBI = 'OBi'
90+ NETGEN = 'Netgen'
6091
61- def to_s
62- phone_number
92+ def initialize data
93+ @urls = data
6394 end
6495
65- private
96+ # @return [String] The Grandstream provisioning url.
97+ def grandstream
98+ self . urls . fetch ( GRANDSTREAM )
99+ end
100+
101+ # @return [String] The OBi provisioning url.
102+ def obi
103+ self . urls . fetch ( OBI )
104+ end
66105
67- def initialize phone_number
68- self . phone_number = phone_number
106+ # @return [String] The Netgen provisioning url.
107+ def netgen
108+ self . urls . fetch ( NETGEN )
69109 end
70110 end
71111
@@ -103,7 +143,9 @@ def create params = {}
103143 # @param id [Integer]
104144 # The ID of the ATA to retrieve information about.
105145 # @param params [Hash]
106- # Any parameters to send to Phaxio. This action takes no unique parameters.
146+ # Any parameters to send to Phaxio.
147+ # - *with_credentials* [Boolean] - If enabled, the username and
148+ # password for the ATA will be included in the response.
107149 # @return [Phaxio::Resources::Ata]
108150 # The requested ATA.
109151 # @raise [Phaxio::Error::PhaxioError]
@@ -148,7 +190,7 @@ def regenerate_credentials id, params = {}
148190
149191 # Delete an ATA
150192 # @param id [Integer]
151- # The Id of the ATA to delete.
193+ # The ID of the ATA to delete.
152194 # @param params [Hash]
153195 # Any parameters to send to Phaxio. This action takes no unique parameters.
154196 # @return [Phaxio::Resources::Ata::Reference]
@@ -167,7 +209,7 @@ def delete id, params = {}
167209 # The phone number to add to the ATA.
168210 # @param params [Hash]
169211 # Any parameters to send to Phaxio. This action takes no unique parameters.
170- # @return [Phaxio::Resources::Ata::PhoneNumberReference ]
212+ # @return [Phaxio::Resources::PhoneNumber::Reference ]
171213 # A reference to the added phone number.
172214 # @raise [Phaxio::Error::PhaxioError]
173215 # @see https://www.phaxio.com/docs/api/v2.1/atas/add_phone_number
@@ -183,7 +225,7 @@ def add_phone_number id, phone_number, params = {}
183225 # The phone number you want to remove.
184226 # @param params [Hash]
185227 # Any parameters to send to Phaxio. This action takes no unique parameters.
186- # @return [Phaxio::Resources::Ata::PhoneNumberReference ]
228+ # @return [Phaxio::Resources::PhoneNumber::Reference ]
187229 # A reference to the removed phone number.
188230 # @raise [Phaxio::Error::PhaxioError]
189231 # @see https://www.phaxio.com/docs/api/v2.1/atas/remove_phone_number
@@ -192,14 +234,30 @@ def remove_phone_number id, phone_number, params = {}
192234 response_phone_number_reference response
193235 end
194236
237+ # Get ATA provisioning URLs for your Phaxio account.
238+ # @param params [Hash]
239+ # Any parameters to send to Phaxio.
240+ # - *group* [String] - If given, this action instead returns
241+ # provisioning URLs for the named group.
242+ # @return [Phaxio::Resources::Ata::ProvisioningURLs
243+ # @see https://www.phaxio.com/docs/api/v2.1/atas/provisioning_urls
244+ def provisioning_urls params = { }
245+ response = Client . request :get , provisioning_urls_endpoint , params
246+ response_provisioning_urls response
247+ end
248+
195249 private
196250
197251 def response_reference response
198252 Reference . new Integer ( response [ 'id' ] )
199253 end
200254
201255 def response_phone_number_reference response
202- PhoneNumberReference . new ( response [ 'phone_number' ] )
256+ PhoneNumber ::Reference . new ( response [ 'phone_number' ] )
257+ end
258+
259+ def response_provisioning_urls response
260+ ProvisioningURLs . new ( response )
203261 end
204262
205263 def atas_endpoint
@@ -217,6 +275,10 @@ def regenerate_credentials_endpoint id
217275 def phone_number_endpoint id , phone_number
218276 "#{ ata_endpoint ( id ) } /phone_numbers/#{ phone_number } "
219277 end
278+
279+ def provisioning_urls_endpoint
280+ "#{ atas_endpoint } /provisioning_urls"
281+ end
220282 end
221283 end
222284 end
0 commit comments