Module: BandwidthIris::ClientWrapper
- Included in:
- Account, AlternateEndUserIdentity, Applications, AvailableNpaNxx, AvailableNumber, City, CoveredRateCenter, Csr, DiscNumber, Disconnect, Dlda, EmergencyNotificationEndpoints, EmergencyNotificationGroups, EmergencyNotificationRecipients, ImportTnChecker, ImportTnOrders, ImportToAccount, InServiceNumber, Lidb, LnpChecker, LsrOrder, Order, PortIn, PortOut, RateCenter, RemoveImportedTnOrders, SipCredential, SipPeer, SipPeerProducts, Site, Subscription, Tn, TnOptions, TnReservation, User
- Defined in:
- lib/bandwidth-iris/client_wrapper.rb
Overview
Allows to make first argument (client instance) of defined singletom function optional
Instance Method Summary collapse
-
#wrap_client_arg(method) ⇒ Object
Make first argument (client instance) of a method optional.
Instance Method Details
#wrap_client_arg(method) ⇒ Object
Make first argument (client instance) of a method optional
18 19 20 21 22 23 24 25 26 |
# File 'lib/bandwidth-iris/client_wrapper.rb', line 18 def wrap_client_arg(method) old = method(method) define_singleton_method(method) do |*args| if(args.size == 0 || !(args[0] || {}).is_a?(Client)) args.unshift(Client.new()) end old.call(*args) end end |