1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# frozen_string_literal: true
class PortInOrder
def initialize(params)
@params = params
@params["SiteId"] = CONFIG[:bandwidth_site]
@params["PeerId"] = CONFIG[:bandwidth_peer]
@params["ProcessingStatus"] = "DRAFT"
@params["Subscriber"]["SubscriberType"] ||= "RESIDENTIAL"
end
def loa_authorizing_person
"%s %s" % [
@params.dig("Subscriber", "FirstName"),
@params.dig("Subscriber", "LastName")
]
end
def to_h
@params.dup.tap do |h|
h["LoaAuthorizingPerson"] = loa_authorizing_person
h["BillingTelephoneNumber"].gsub!(/[^\d]/, "")
h["BillingTelephoneNumber"].gsub!(/\A1(\d{10})\Z/) { $1 }
h["ListOfPhoneNumbers"] = {
"PhoneNumber" => h["BillingTelephoneNumber"]
}
end
end
end