Class: PinterestSdkClient::MediaApi
- Inherits:
-
Object
- Object
- PinterestSdkClient::MediaApi
- Defined in:
- lib/pinterest_sdk/api/media_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#initialize(api_client = ApiClient.default) ⇒ MediaApi
constructor
A new instance of MediaApi.
-
#media_create(media_upload_request, opts = {}) ⇒ MediaUpload
Register media upload Register your intent to upload media The response includes all of the information needed to upload the media to Pinterest.
-
#media_create_with_http_info(media_upload_request, opts = {}) ⇒ Array<(MediaUpload, Integer, Hash)>
Register media upload Register your intent to upload media The response includes all of the information needed to upload the media to Pinterest.
-
#media_get(media_id, opts = {}) ⇒ MediaUploadDetails
Get media upload details Get details for a registered media upload, including its current status.
-
#media_get_with_http_info(media_id, opts = {}) ⇒ Array<(MediaUploadDetails, Integer, Hash)>
Get media upload details Get details for a registered media upload, including its current status.
-
#media_list(opts = {}) ⇒ Paginated
List media uploads List media uploads filtered by given parameters.
-
#media_list_with_http_info(opts = {}) ⇒ Array<(Paginated, Integer, Hash)>
List media uploads List media uploads filtered by given parameters.
Constructor Details
Instance Attribute Details
#api_client ⇒ Object
Returns the value of attribute api_client.
17 18 19 |
# File 'lib/pinterest_sdk/api/media_api.rb', line 17 def api_client @api_client end |
Instance Method Details
#media_create(media_upload_request, opts = {}) ⇒ MediaUpload
Register media upload Register your intent to upload media The response includes all of the information needed to upload the media to Pinterest. To upload the media, make an HTTP POST request (using curl, for example) to upload_url using the Content-Type header value. Send the media file’s contents as the request’s file parameter and also include all of the parameters from upload_parameters. <strong><a href=‘/docs/solutions/content-apps/#creatingvideopins’>Learn more</a></strong> about video Pin creation.
27 28 29 30 |
# File 'lib/pinterest_sdk/api/media_api.rb', line 27 def media_create(media_upload_request, opts = {}) data, _status_code, _headers = media_create_with_http_info(media_upload_request, opts) data end |
#media_create_with_http_info(media_upload_request, opts = {}) ⇒ Array<(MediaUpload, Integer, Hash)>
Register media upload Register your intent to upload media The response includes all of the information needed to upload the media to Pinterest. To upload the media, make an HTTP POST request (using <tt>curl</tt>, for example) to <tt>upload_url</tt> using the <tt>Content-Type</tt> header value. Send the media file's contents as the request's <tt>file</tt> parameter and also include all of the parameters from <tt>upload_parameters</tt>. <strong><a href='/docs/solutions/content-apps/#creatingvideopins'>Learn more</a></strong> about video Pin creation.
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/pinterest_sdk/api/media_api.rb', line 37 def media_create_with_http_info(media_upload_request, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: MediaApi.media_create ...' end # verify the required parameter 'media_upload_request' is set if @api_client.config.client_side_validation && media_upload_request.nil? fail ArgumentError, "Missing the required parameter 'media_upload_request' when calling MediaApi.media_create" end # resource path local_var_path = '/media' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' content_type = @api_client.select_header_content_type(['application/json']) if !content_type.nil? header_params['Content-Type'] = content_type end # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(media_upload_request) # return_type return_type = opts[:debug_return_type] || 'MediaUpload' # auth_names auth_names = opts[:debug_auth_names] || ['pinterest_oauth2'] = opts.merge( :operation => :"MediaApi.media_create", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:POST, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: MediaApi#media_create\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#media_get(media_id, opts = {}) ⇒ MediaUploadDetails
Get media upload details Get details for a registered media upload, including its current status. <strong><a href=‘/docs/solutions/content-apps/#creatingvideopins’>Learn more</a></strong> about video Pin creation.
95 96 97 98 |
# File 'lib/pinterest_sdk/api/media_api.rb', line 95 def media_get(media_id, opts = {}) data, _status_code, _headers = media_get_with_http_info(media_id, opts) data end |
#media_get_with_http_info(media_id, opts = {}) ⇒ Array<(MediaUploadDetails, Integer, Hash)>
Get media upload details Get details for a registered media upload, including its current status. <strong><a href='/docs/solutions/content-apps/#creatingvideopins'>Learn more</a></strong> about video Pin creation.
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 |
# File 'lib/pinterest_sdk/api/media_api.rb', line 105 def media_get_with_http_info(media_id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: MediaApi.media_get ...' end # verify the required parameter 'media_id' is set if @api_client.config.client_side_validation && media_id.nil? fail ArgumentError, "Missing the required parameter 'media_id' when calling MediaApi.media_get" end pattern = Regexp.new(/^\d+$/) if @api_client.config.client_side_validation && media_id !~ pattern fail ArgumentError, "invalid value for 'media_id' when calling MediaApi.media_get, must conform to the pattern #{pattern}." end # resource path local_var_path = '/media/{media_id}'.sub('{' + 'media_id' + '}', CGI.escape(media_id.to_s)) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'MediaUploadDetails' # auth_names auth_names = opts[:debug_auth_names] || ['pinterest_oauth2'] = opts.merge( :operation => :"MediaApi.media_get", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: MediaApi#media_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#media_list(opts = {}) ⇒ Paginated
List media uploads List media uploads filtered by given parameters. <strong><a href=‘/docs/solutions/content-apps/#creatingvideopins’>Learn more</a></strong> about video Pin creation.
164 165 166 167 |
# File 'lib/pinterest_sdk/api/media_api.rb', line 164 def media_list(opts = {}) data, _status_code, _headers = media_list_with_http_info(opts) data end |
#media_list_with_http_info(opts = {}) ⇒ Array<(Paginated, Integer, Hash)>
List media uploads List media uploads filtered by given parameters. <strong><a href='/docs/solutions/content-apps/#creatingvideopins'>Learn more</a></strong> about video Pin creation.
175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 |
# File 'lib/pinterest_sdk/api/media_api.rb', line 175 def media_list_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: MediaApi.media_list ...' end if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 100 fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling MediaApi.media_list, must be smaller than or equal to 100.' end if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 1 fail ArgumentError, 'invalid value for "opts[:"page_size"]" when calling MediaApi.media_list, must be greater than or equal to 1.' end # resource path local_var_path = '/media' # query parameters query_params = opts[:query_params] || {} query_params[:'bookmark'] = opts[:'bookmark'] if !opts[:'bookmark'].nil? query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'Paginated' # auth_names auth_names = opts[:debug_auth_names] || ['pinterest_oauth2'] = opts.merge( :operation => :"MediaApi.media_list", :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type ) data, status_code, headers = @api_client.call_api(:GET, local_var_path, ) if @api_client.config.debugging @api_client.config.logger.debug "API called: MediaApi#media_list\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |