Module: Zendesk::Properties::InstanceMethods

Defined in:
lib/zendesk/lib/properties.rb

Instance Method Summary collapse

Instance Method Details

#attributesObject



71
72
73
# File 'lib/zendesk/lib/properties.rb', line 71

def attributes
  self.class._attributes
end

#load_attributes(attrs = {}) ⇒ Object



83
84
85
86
87
88
89
# File 'lib/zendesk/lib/properties.rb', line 83

def load_attributes(attrs = {})
  attributes.each do |attr|
    if val = (attrs[attr.to_s] || attrs[attr.to_sym])
      instance_variable_set :"@#{attr.to_s}", val
    end
  end
end

#load_properties(attrs = {}) ⇒ Object



100
101
102
103
104
105
106
107
# File 'lib/zendesk/lib/properties.rb', line 100

def load_properties(attrs = {})
  properties.each do |mn|
    method_name = mn.to_s
    if val = (attrs[method_name] || attrs[method_name.to_sym])
      send(:"#{method_name}=", val)
    end
  end
end

#load_protected_attributes(attrs = {}) ⇒ Object



91
92
93
94
95
96
97
# File 'lib/zendesk/lib/properties.rb', line 91

def load_protected_attributes(attrs = {})
  protected_attributes.each do |attr|
    if val = (attrs[attr.to_s] || attrs[attr.to_sym])
      instance_variable_set :"@#{attr.to_s}", val
    end
  end
end

#propertiesObject



75
76
77
# File 'lib/zendesk/lib/properties.rb', line 75

def properties
  self.class._properties
end

#protected_attributesObject



79
80
81
# File 'lib/zendesk/lib/properties.rb', line 79

def protected_attributes
  self.class._protected_attributes
end