Class: ZenfolioAPI::Record
- Inherits:
-
Object
- Object
- ZenfolioAPI::Record
- Defined in:
- lib/ZenfolioAPI/record.rb
Direct Known Subclasses
Model::AccessDescriptor, Model::ExifTag, Model::Gallery, Model::Group, Model::GroupElement, Model::Image, Model::User
Instance Method Summary collapse
-
#initialize(params) ⇒ Record
constructor
A new instance of Record.
- #instance_variable_hash ⇒ Object
-
#to_json ⇒ Object
Display Gallery is JSON format.
Constructor Details
#initialize(params) ⇒ Record
Returns a new instance of Record.
3 4 5 6 7 8 9 10 |
# File 'lib/ZenfolioAPI/record.rb', line 3 def initialize params return if params.nil? params.each do |key, value| name = key.to_s instance_variable_set("@#{name}", value) if respond_to?(name) end end |
Instance Method Details
#instance_variable_hash ⇒ Object
19 20 21 |
# File 'lib/ZenfolioAPI/record.rb', line 19 def instance_variable_hash Hash[instance_variables.map { |name| [name[1..-1], instance_variable_get(name)] } ] end |
#to_json ⇒ Object
Display Gallery is JSON format
15 16 17 |
# File 'lib/ZenfolioAPI/record.rb', line 15 def to_json self.instance_variable_hash end |