Module: Strava::Api::Endpoints::Uploads

Included in:
Client
Defined in:
lib/strava/api/endpoints/uploads.rb

Instance Method Summary collapse

Instance Method Details

#create_upload(options = {}) ⇒ Object

Uploads a new data file to create an activity from.

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :file (File)

    The uploaded file.

  • :name (String)

    The desired name of the resulting activity.

  • :description (String)

    The desired description of the resulting activity.

  • :trainer (Boolean)

    Whether the resulting activity should be marked as having been performed on a trainer.

  • :commute (Boolean)

    Whether the resulting activity should be tagged as a commute.

  • :data_type (String)

    The format of the uploaded file.

  • :external_id (String)

    The desired external identifier of the resulting activity.



25
26
27
# File 'lib/strava/api/endpoints/uploads.rb', line 25

def create_upload(options = {})
  Strava::Models::Upload.new(post('uploads', options))
end

#upload(id_or_options, options = {}) ⇒ Object

Returns an upload for a given identifier.

Parameters:

  • options (Hash) (defaults to: {})

    a customizable set of options

Options Hash (options):

  • :id (String)

    The identifier of the upload.



35
36
37
38
# File 'lib/strava/api/endpoints/uploads.rb', line 35

def upload(id_or_options, options = {})
  id, options = parse_args(id_or_options, options)
  Strava::Models::Upload.new(get("uploads/#{id}", options))
end