Method: Unsplash::Client#reload!

Defined in:
lib/unsplash/client.rb

#reload!Unspash::Client

(Re)load full object details from Unsplash.

Returns:

  • (Unspash::Client)

    Itself, with full details reloaded.



15
16
17
18
19
20
21
22
23
# File 'lib/unsplash/client.rb', line 15

def reload!
  if links && links["self"]
    attrs = JSON.parse(connection.get(links["self"]).body)
    @attributes = OpenStruct.new(attrs)
    self
  else
    raise Unsplash::Error.new "Missing self link for #{self.class} with ID #{self.id}"
  end
end