Module: Bitly::API::Base

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#responseObject (readonly)

Returns the value of attribute response.



7
8
9
# File 'lib/bitly/api/base.rb', line 7

def response
  @response
end

Instance Method Details

#assign_attributes(attributes) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/bitly/api/base.rb', line 9

def assign_attributes(attributes)
  if self.class.respond_to?(:attributes)
    self.class.attributes.each do |attr|
      instance_variable_set("@#{attr}", attributes[attr.to_s]) if attributes[attr.to_s]
    end
  end
  if self.class.respond_to?(:time_attributes)
    self.class.time_attributes.each do |attr|
      instance_variable_set("@#{attr}", Time.parse(attributes[attr.to_s])) if attributes[attr.to_s]
    end
  end
end