lib/telnyx/util.rb in telnyx-0.0.8 vs lib/telnyx/util.rb in telnyx-0.1.0
- old
+ new
@@ -37,22 +37,40 @@
end
def self.object_classes
@object_classes ||= {
# business objects
- AlphanumericSenderId::OBJECT_NAME => AlphanumericSenderId,
- AvailablePhoneNumber::OBJECT_NAME => AvailablePhoneNumber,
- Call::OBJECT_NAME => Call,
- Conferences::OBJECT_NAME => Conferences,
- Message::OBJECT_NAME => Message,
- MessagingPhoneNumber::OBJECT_NAME => MessagingPhoneNumber,
- MessagingProfile::OBJECT_NAME => MessagingProfile,
- NumberOrder::OBJECT_NAME => NumberOrder,
- NumberReservation::OBJECT_NAME => NumberReservation,
- PublicKey::OBJECT_NAME => PublicKey,
- PhoneNumber::OBJECT_NAME => PhoneNumber,
- SimCard::OBJECT_NAME => SimCard,
+ Address::OBJECT_NAME => Address,
+ AlphanumericSenderId::OBJECT_NAME => AlphanumericSenderId,
+ AvailablePhoneNumber::OBJECT_NAME => AvailablePhoneNumber,
+ BillingGroup::OBJECT_NAME => BillingGroup,
+ Call::OBJECT_NAME => Call,
+ CallControlApplication::OBJECT_NAME => CallControlApplication,
+ Conferences::OBJECT_NAME => Conferences,
+ Connection::OBJECT_NAME => Connection,
+ CredentialConnection::OBJECT_NAME => CredentialConnection,
+ FQDNConnection::OBJECT_NAME => FQDNConnection,
+ FQDN::OBJECT_NAME => FQDN,
+ IP::OBJECT_NAME => IP,
+ IPConnection::OBJECT_NAME => IPConnection,
+ Message::OBJECT_NAME => Message,
+ MessagingPhoneNumber::OBJECT_NAME => MessagingPhoneNumber,
+ MessagingProfile::OBJECT_NAME => MessagingProfile,
+ NumberOrder::OBJECT_NAME => NumberOrder,
+ NumberOrderDocument::OBJECT_NAME => NumberOrderDocument,
+ "phone_number_reservation" => NumberReservation,
+ NumberReservation::OBJECT_NAME => NumberReservation,
+ PhoneNumber::OBJECT_NAME => PhoneNumber,
+ PhoneNumberRegulatoryRequirement::OBJECT_NAME => PhoneNumberRegulatoryRequirement,
+ "phone_number_regulatory_group" => PhoneNumberRegulatoryRequirement,
+ Portout::OBJECT_NAME => Portout,
+ PublicKey::OBJECT_NAME => PublicKey,
+ WirelessDetailRecordsReport::OBJECT_NAME => WirelessDetailRecordsReport,
+ # 'phone_number_regulatory_group' => RegulatoryRequirement,
+ RegulatoryRequirement::OBJECT_NAME => RegulatoryRequirement,
+ SimCard::OBJECT_NAME => SimCard,
+ OutboundVoiceProfile::OBJECT_NAME => OutboundVoiceProfile,
}
end
def self.push_object_class(key, klass)
object_classes
@@ -77,10 +95,10 @@
data.map { |i| convert_to_telnyx_object(i, opts) }
when Hash
# Try converting to a known object class. If none available, fall back to generic TelnyxObject
if data[:data].is_a?(Array)
ListObject.construct_from(data, opts)
- elsif data[:data] && data[:data][:record_type]
+ elsif data[:data].is_a?(Hash) && data[:data][:record_type]
object_classes.fetch(data[:data][:record_type], TelnyxObject).construct_from(data[:data], opts)
elsif data[:record_type]
object_classes.fetch(data[:record_type], TelnyxObject).construct_from(data, opts)
else
TelnyxObject.construct_from(data, opts)