Class: Strava::Photo

Inherits:
Base
  • Object
show all
Defined in:
lib/strava/photo.rb

Overview

Strava allows for attaching photos to activities. These photos can come from either Instagram or be uploaded directly to Strava. Initially, only Instagram was supported. Later, Strava began storing photos on its own.

Example:

ca = Strava::Athlete.current_athlete
activity = ca.activities.detect{ |a| a.total_photo_count > 0 }  # Find activity with any photos, Strava or Instagram.
activity = ca.activities.detect{ |a| a.photo_count > 0 }        # Check for Instagram photos only
activity.photos                                                 # Array of `Photo` objects

Instance Attribute Summary

Attributes inherited from Base

#client, #id, #response

Instance Method Summary collapse

Methods inherited from Base

#detailed?, #initialize, #resource_state, resource_states, #summary?

Constructor Details

This class inherits a constructor from Strava::Base

Instance Method Details

#update(data, **opts) ⇒ self

Updates photo with passed data attributes.

Parameters:

  • data (Hash)

    data hash containing photo data

Returns:

  • (self)


20
21
22
23
24
25
26
27
28
29
30
# File 'lib/strava/photo.rb', line 20

def update(data, **opts)
  @resource_state = data['resource_state']
  @activity_id    = data['activity_id']
  @ref            = data["ref"]
  @uid            = data["uid"]
  @caption        = data["caption"]
  @type           = data["type"]
  @uploaded_at    = data["uploaded_at"]
  @created_at     = data["created_at"]
  @location       = data["location"]
end