Class: Google::APIClient::MediaUpload

Inherits:
Object
  • Object
show all
Defined in:
lib/google/api_client/discovery/media.rb

Overview

Media upload elements for discovered methods

Instance Method Summary collapse

Constructor Details

#initialize(api, method_base, discovery_document) ⇒ Google::APIClient::Method

Creates a description of a particular method.

Parameters:

  • api (Google::APIClient::API)

    Base discovery document for the API

  • method_base (Addressable::URI)

    The base URI for the service.

  • discovery_document (Hash)

    The media upload section of the discovery document.



39
40
41
42
43
# File 'lib/google/api_client/discovery/media.rb', line 39

def initialize(api, method_base, discovery_document)
  @api = api
  @method_base = method_base
  @discovery_document = discovery_document
end

Instance Method Details

#accepted_typesArray

List of acceptable mime types

Returns:

  • (Array)

    List of acceptable mime types for uploaded content



50
51
52
# File 'lib/google/api_client/discovery/media.rb', line 50

def accepted_types
  @discovery_document['accept']
end

#max_sizeString

Maximum size of an uplad TODO: Parse & convert to numeric value

Returns:

  • (String)


59
60
61
# File 'lib/google/api_client/discovery/media.rb', line 59

def max_size
  @discovery_document['maxSize']
end

#uri_templateAddressable::Template

Returns the URI template for the method. A parameter list can be used to expand this into a URI.

Returns:

  • (Addressable::Template)

    The URI template.



68
69
70
71
72
# File 'lib/google/api_client/discovery/media.rb', line 68

def uri_template
  return @uri_template ||= Addressable::Template.new(
    @api.method_base.join(Addressable::URI.parse(@discovery_document['protocols']['simple']['path']))
  )
end