Class: BigMarkerClient::Models::Base
- Inherits:
-
Object
- Object
- BigMarkerClient::Models::Base
- Defined in:
- lib/big_marker_client/models/base.rb
Direct Known Subclasses
Attendee, Conference, DialInInformation, Handout, PreloadFile, Presenter, Registrant, SurveyResult, WebinarStats
Instance Method Summary collapse
-
#initialize(hash) ⇒ Base
constructor
A new instance of Base.
- #to_h ⇒ Object
Constructor Details
#initialize(hash) ⇒ Base
Returns a new instance of Base.
4 5 6 7 8 9 |
# File 'lib/big_marker_client/models/base.rb', line 4 def initialize(hash) return unless hash.is_a?(Hash) known_attributes = self.class.instance_methods hash.each { |k, v| known_attributes.include?(k.to_sym) ? send(:"#{k}=", v) : warn("missing property: #{k}") } end |
Instance Method Details
#to_h ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/big_marker_client/models/base.rb', line 11 def to_h instance_variables.each_with_object({}) do |var, hash| value = instance_variable_get(var) hash[key(var)] = if value.is_a?(Array) && !value.empty? && value.first.is_a?(::BigMarkerClient::Models::Base) value.map(&:to_h) elsif value.is_a?(::BigMarkerClient::Models::Base) value.to_h else value end end end |