Class: Ari::Model
- Inherits:
-
Object
- Object
- Ari::Model
- Defined in:
- lib/ari/model.rb
Direct Known Subclasses
AsteriskInfo, BuildInfo, CallerID, ConfigInfo, Dialed, DialplanCEP, Event, FormatLangPair, LiveRecording, Message, Resource, SetId, StatusInfo, StoredRecording, SystemInfo, TextMessage, TextMessageVariable, Variable
Instance Method Summary collapse
- #attributes=(attributes) ⇒ Object
-
#initialize(attributes) ⇒ Model
constructor
A new instance of Model.
Constructor Details
#initialize(attributes) ⇒ Model
Returns a new instance of Model.
6 7 8 9 10 11 |
# File 'lib/ari/model.rb', line 6 def initialize(attributes) if attributes @client = attributes.delete(:client) self.attributes = attributes end end |
Instance Method Details
#attributes=(attributes) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/ari/model.rb', line 13 def attributes=(attributes) attributes.each do |name, value| setter = "#{name}=" if respond_to? setter value.merge!(client: @client) if @client && value.is_a?(Hash) __send__ setter, value else instance_variable_set "@#{name}", value end end end |