Method: Eventbrite::EventbriteObject#method_missing

Defined in:
lib/eventbrite/eventbrite_object.rb

#method_missing(name, *args) ⇒ Object (protected)



148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
# File 'lib/eventbrite/eventbrite_object.rb', line 148

def method_missing(name, *args)
  # TODO: only allow setting in updateable classes.
  if name.to_s.end_with?('=')
    attr = name.to_s[0...-1].to_sym
    @values[attr] = args[0]
    @unsaved_values.add(attr)
    add_accessors([attr])
    return
  else
    return @values[name] if @values.has_key?(name)
  end

  begin
    super
  rescue NoMethodError => e
    if @transient_values.include?(name)
      raise NoMethodError.new(e.message + ".  HINT: The '#{name}' attribute was set in the past, however.  It was then wiped when refreshing the object with the result returned by Eventbrite's API, probably as a result of a save().  The attributes currently available on this object are: #{@values.keys.join(', ')}")
    else
      raise
    end
  end
end