bandwidth_tn_repo.rb

 1# frozen_string_literal: true
 2
 3require "ruby-bandwidth-iris"
 4
 5class BandwidthTnRepo
 6	def find(tel)
 7		BandwidthIris::Tn.new(telephone_number: tel).get_details
 8	end
 9
10	def put_lidb_name(tel, lidb_name)
11		BandwidthIris::Lidb.create(
12			lidb_tn_groups: { lidb_tn_group: {
13				telephone_numbers: [tel.sub(/\A\+1/, "")],
14				subscriber_information: lidb_name,
15				use_type: "RESIDENTIAL", visibility: "PUBLIC"
16			} }
17		)
18	rescue BandwidthIris::Errors::GenericError
19		raise "Could not set CNAM, please contact support"
20	end
21end