Module: BandwidthIris::ApiItem
- Included in:
- AlternateEndUserIdentity, Applications, CoveredRateCenter, Csr, DiscNumber, Disconnect, Dlda, EmergencyNotificationEndpoints, EmergencyNotificationGroups, EmergencyNotificationRecipients, ImportTnChecker, ImportTnOrders, ImportToAccount, LsrOrder, Order, PortIn, PortOut, RemoveImportedTnOrders, SipCredential, SipPeer, SipPeerProducts, Site, Subscription, Tn, TnOptions, TnReservation, User
- Defined in:
- lib/bandwidth-iris/api_item.rb
Overview
Module which adds common operations for all Catapult api related classes
Instance Method Summary collapse
-
#[](name) ⇒ Object
Return item of @data by name.
-
#[]=(name, value) ⇒ Object
Set value of @data’s item by name.
-
#initialize(data = {}, client = nil) ⇒ Object
Initializer.
-
#to_data ⇒ Object
Return data of api item as hash.
Instance Method Details
#[](name) ⇒ Object
Return item of @data by name
27 28 29 |
# File 'lib/bandwidth-iris/api_item.rb', line 27 def [] (name) @data[name] end |
#[]=(name, value) ⇒ Object
Set value of @data’s item by name
32 33 34 |
# File 'lib/bandwidth-iris/api_item.rb', line 32 def []= (name, value) @data[name] = value end |
#initialize(data = {}, client = nil) ⇒ Object
Initializer
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/bandwidth-iris/api_item.rb', line 8 def initialize(data={}, client = nil) @client = client || Client.new() @data = (data || {}).clone() @data.each do |k,v| self.define_singleton_method(k) do @data[k] end self.define_singleton_method("#{k}=".to_sym()) do |val| @data[k] = val end end end |
#to_data ⇒ Object
Return data of api item as hash
22 23 24 |
# File 'lib/bandwidth-iris/api_item.rb', line 22 def to_data() @data.clone() end |