constantcontact 2.2.1 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (30) hide show
  1. checksums.yaml +4 -4
  2. data/.rspec +2 -2
  3. data/README.md +56 -1
  4. data/constantcontact.gemspec +1 -1
  5. data/lib/constantcontact/api.rb +111 -97
  6. data/lib/constantcontact/services/account_service.rb +20 -22
  7. data/lib/constantcontact/services/activity_service.rb +98 -100
  8. data/lib/constantcontact/services/base_service.rb +46 -44
  9. data/lib/constantcontact/services/campaign_schedule_service.rb +72 -74
  10. data/lib/constantcontact/services/campaign_tracking_service.rb +103 -105
  11. data/lib/constantcontact/services/contact_service.rb +73 -75
  12. data/lib/constantcontact/services/contact_tracking_service.rb +103 -105
  13. data/lib/constantcontact/services/email_marketing_service.rb +64 -66
  14. data/lib/constantcontact/services/event_spot_service.rb +356 -358
  15. data/lib/constantcontact/services/library_service.rb +228 -230
  16. data/lib/constantcontact/services/list_service.rb +55 -57
  17. data/lib/constantcontact/version.rb +1 -1
  18. data/spec/constantcontact/api_spec.rb +2 -4
  19. data/spec/constantcontact/services/account_service_spec.rb +3 -2
  20. data/spec/constantcontact/services/activity_service_spec.rb +10 -9
  21. data/spec/constantcontact/services/base_service_spec.rb +7 -5
  22. data/spec/constantcontact/services/campaign_schedule_service_spec.rb +7 -6
  23. data/spec/constantcontact/services/campaign_tracking_service_spec.rb +8 -7
  24. data/spec/constantcontact/services/contact_service_spec.rb +8 -7
  25. data/spec/constantcontact/services/contact_tracking_service_spec.rb +8 -7
  26. data/spec/constantcontact/services/email_marketing_spec.rb +7 -6
  27. data/spec/constantcontact/services/event_spot_spec.rb +28 -27
  28. data/spec/constantcontact/services/library_service_spec.rb +17 -16
  29. data/spec/constantcontact/services/list_service_spec.rb +6 -5
  30. metadata +20 -20
@@ -7,275 +7,273 @@
7
7
  module ConstantContact
8
8
  module Services
9
9
  class LibraryService < BaseService
10
- class << self
11
10
 
12
- # Retrieve MyLibrary usage information
13
- # @return [LibrarySummary]
14
- def get_library_info()
15
- url = Util::Config.get('endpoints.base_url') + Util::Config.get('endpoints.library_info')
11
+ # Retrieve MyLibrary usage information
12
+ # @return [LibrarySummary]
13
+ def get_library_info()
14
+ url = Util::Config.get('endpoints.base_url') + Util::Config.get('endpoints.library_info')
16
15
 
17
- response = RestClient.get(url, get_headers())
18
- Components::LibrarySummary.create(JSON.parse(response.body).first)
19
- end
16
+ response = RestClient.get(url, get_headers())
17
+ Components::LibrarySummary.create(JSON.parse(response.body).first)
18
+ end
20
19
 
21
20
 
22
- # Retrieve a list of MyLibrary folders
23
- # @param [Hash] params - hash of query parameters and values to append to the request.
24
- # Allowed parameters include:
25
- # sort_by - The method to sort by, valid values are :
26
- # CREATED_DATE - sorts by date folder was added, ascending (earliest to latest)
27
- # CREATED_DATE_DESC - (default) sorts by date folder was added, descending (latest to earliest)
28
- # MODIFIED_DATE - sorts by date folder was last modified, ascending (earliest to latest)
29
- # MODIFIED_DATE_DESC - sorts by date folder was last modified, descending (latest to earliest)
30
- # NAME - sorts alphabetically by folder name, a to z
31
- # NAME_DESC - sorts alphabetically by folder name, z to a
32
- # limit - Specifies the number of results displayed per page of output, from 1 - 50, default = 50.
33
- # @return [ResultSet<LibraryFolder>]
34
- def get_library_folders(params)
35
- url = Util::Config.get('endpoints.base_url') + Util::Config.get('endpoints.library_folders')
36
- url = build_url(url, params)
37
- response = RestClient.get(url, get_headers())
38
- folders = []
39
- body = JSON.parse(response.body)
40
- body['results'].each do |folder|
41
- folders << Components::LibraryFolder.create(folder)
42
- end
43
- Components::ResultSet.new(folders, body['meta'])
21
+ # Retrieve a list of MyLibrary folders
22
+ # @param [Hash] params - hash of query parameters and values to append to the request.
23
+ # Allowed parameters include:
24
+ # sort_by - The method to sort by, valid values are :
25
+ # CREATED_DATE - sorts by date folder was added, ascending (earliest to latest)
26
+ # CREATED_DATE_DESC - (default) sorts by date folder was added, descending (latest to earliest)
27
+ # MODIFIED_DATE - sorts by date folder was last modified, ascending (earliest to latest)
28
+ # MODIFIED_DATE_DESC - sorts by date folder was last modified, descending (latest to earliest)
29
+ # NAME - sorts alphabetically by folder name, a to z
30
+ # NAME_DESC - sorts alphabetically by folder name, z to a
31
+ # limit - Specifies the number of results displayed per page of output, from 1 - 50, default = 50.
32
+ # @return [ResultSet<LibraryFolder>]
33
+ def get_library_folders(params)
34
+ url = Util::Config.get('endpoints.base_url') + Util::Config.get('endpoints.library_folders')
35
+ url = build_url(url, params)
36
+ response = RestClient.get(url, get_headers())
37
+ folders = []
38
+ body = JSON.parse(response.body)
39
+ body['results'].each do |folder|
40
+ folders << Components::LibraryFolder.create(folder)
44
41
  end
42
+ Components::ResultSet.new(folders, body['meta'])
43
+ end
45
44
 
46
45
 
47
- # Create a new MyLibrary folder
48
- # @param [LibraryFolder] folder - MyLibrary folder to be created
49
- # @return [LibraryFolder]
50
- def add_library_folder(folder)
51
- url = Util::Config.get('endpoints.base_url') + Util::Config.get('endpoints.library_folders')
52
- url = build_url(url)
53
- payload = folder.to_json
54
- response = RestClient.post(url, payload, get_headers())
55
- Components::LibraryFolder.create(JSON.parse(response.body))
56
- end
46
+ # Create a new MyLibrary folder
47
+ # @param [LibraryFolder] folder - MyLibrary folder to be created
48
+ # @return [LibraryFolder]
49
+ def add_library_folder(folder)
50
+ url = Util::Config.get('endpoints.base_url') + Util::Config.get('endpoints.library_folders')
51
+ url = build_url(url)
52
+ payload = folder.to_json
53
+ response = RestClient.post(url, payload, get_headers())
54
+ Components::LibraryFolder.create(JSON.parse(response.body))
55
+ end
57
56
 
58
57
 
59
- # Retrieve a specific MyLibrary folder using the folder_id path parameter
60
- # @param [String] folder_id - The ID for the folder to return
61
- # @return [LibraryFolder]
62
- def get_library_folder(folder_id)
63
- url = Util::Config.get('endpoints.base_url') + sprintf(Util::Config.get('endpoints.library_folder'), folder_id)
64
- url = build_url(url)
65
- response = RestClient.get(url, get_headers())
66
- Components::LibraryFolder.create(JSON.parse(response.body))
67
- end
58
+ # Retrieve a specific MyLibrary folder using the folder_id path parameter
59
+ # @param [String] folder_id - The ID for the folder to return
60
+ # @return [LibraryFolder]
61
+ def get_library_folder(folder_id)
62
+ url = Util::Config.get('endpoints.base_url') + sprintf(Util::Config.get('endpoints.library_folder'), folder_id)
63
+ url = build_url(url)
64
+ response = RestClient.get(url, get_headers())
65
+ Components::LibraryFolder.create(JSON.parse(response.body))
66
+ end
68
67
 
69
68
 
70
- # Update a specific MyLibrary folder
71
- # @param [LibraryFolder] folder - MyLibrary folder to be updated
72
- # @return [LibraryFolder]
73
- def update_library_folder(folder)
74
- url = Util::Config.get('endpoints.base_url') +
75
- sprintf(Util::Config.get('endpoints.library_folder'), folder.id)
76
- url = build_url(url)
77
- payload = folder.to_json
78
- response = RestClient.put(url, payload, get_headers())
79
- Components::LibraryFolder.create(JSON.parse(response.body))
80
- end
69
+ # Update a specific MyLibrary folder
70
+ # @param [LibraryFolder] folder - MyLibrary folder to be updated
71
+ # @return [LibraryFolder]
72
+ def update_library_folder(folder)
73
+ url = Util::Config.get('endpoints.base_url') +
74
+ sprintf(Util::Config.get('endpoints.library_folder'), folder.id)
75
+ url = build_url(url)
76
+ payload = folder.to_json
77
+ response = RestClient.put(url, payload, get_headers())
78
+ Components::LibraryFolder.create(JSON.parse(response.body))
79
+ end
81
80
 
82
81
 
83
- # Delete a MyLibrary folder
84
- # @param [String] folder_id - The ID for the MyLibrary folder to delete
85
- # @return [Boolean]
86
- def delete_library_folder(folder_id)
87
- url = Util::Config.get('endpoints.base_url') + sprintf(Util::Config.get('endpoints.library_folder'), folder_id)
88
- url = build_url(url)
89
- response = RestClient.delete(url, get_headers())
90
- response.code == 204
91
- end
82
+ # Delete a MyLibrary folder
83
+ # @param [String] folder_id - The ID for the MyLibrary folder to delete
84
+ # @return [Boolean]
85
+ def delete_library_folder(folder_id)
86
+ url = Util::Config.get('endpoints.base_url') + sprintf(Util::Config.get('endpoints.library_folder'), folder_id)
87
+ url = build_url(url)
88
+ response = RestClient.delete(url, get_headers())
89
+ response.code == 204
90
+ end
92
91
 
93
92
 
94
- # Retrieve all files in the Trash folder
95
- # @param [Hash] params - hash of query parameters and values to append to the request.
96
- # Allowed parameters include:
97
- # type - Specifies the type of files to retrieve, valid values are : ALL, IMAGES, or DOCUMENTS
98
- # sort_by - The method to sort by, valid values are :
99
- # ADDED_DATE - sorts by date folder was added, ascending (earliest to latest)
100
- # ADDED_DATE_DESC - (default) sorts by date folder was added, descending (latest to earliest)
101
- # MODIFIED_DATE - sorts by date folder was last modified, ascending (earliest to latest)
102
- # MODIFIED_DATE_DESC - sorts by date folder was last modified, descending (latest to earliest)
103
- # NAME - sorts alphabetically by file name, a to z
104
- # NAME_DESC - sorts alphabetically by file name, z to a
105
- # SIZE - sorts by file size, smallest to largest
106
- # SIZE_DESC - sorts by file size, largest to smallest
107
- # DIMENSION - sorts by file dimensions (hxw), smallest to largest
108
- # DIMENSION_DESC - sorts by file dimensions (hxw), largest to smallest
109
- # limit - Specifies the number of results displayed per page of output, from 1 - 50, default = 50.
110
- # @return [ResultSet<LibraryFile>]
111
- def get_library_trash(params)
112
- url = Util::Config.get('endpoints.base_url') + Util::Config.get('endpoints.library_folder_trash')
113
- url = build_url(url, params)
114
- response = RestClient.get(url, get_headers())
115
- files = []
116
- body = JSON.parse(response.body)
117
- body['results'].each do |file|
118
- files << Components::LibraryFile.create(file)
119
- end
120
- Components::ResultSet.new(files, body['meta'])
93
+ # Retrieve all files in the Trash folder
94
+ # @param [Hash] params - hash of query parameters and values to append to the request.
95
+ # Allowed parameters include:
96
+ # type - Specifies the type of files to retrieve, valid values are : ALL, IMAGES, or DOCUMENTS
97
+ # sort_by - The method to sort by, valid values are :
98
+ # ADDED_DATE - sorts by date folder was added, ascending (earliest to latest)
99
+ # ADDED_DATE_DESC - (default) sorts by date folder was added, descending (latest to earliest)
100
+ # MODIFIED_DATE - sorts by date folder was last modified, ascending (earliest to latest)
101
+ # MODIFIED_DATE_DESC - sorts by date folder was last modified, descending (latest to earliest)
102
+ # NAME - sorts alphabetically by file name, a to z
103
+ # NAME_DESC - sorts alphabetically by file name, z to a
104
+ # SIZE - sorts by file size, smallest to largest
105
+ # SIZE_DESC - sorts by file size, largest to smallest
106
+ # DIMENSION - sorts by file dimensions (hxw), smallest to largest
107
+ # DIMENSION_DESC - sorts by file dimensions (hxw), largest to smallest
108
+ # limit - Specifies the number of results displayed per page of output, from 1 - 50, default = 50.
109
+ # @return [ResultSet<LibraryFile>]
110
+ def get_library_trash(params)
111
+ url = Util::Config.get('endpoints.base_url') + Util::Config.get('endpoints.library_folder_trash')
112
+ url = build_url(url, params)
113
+ response = RestClient.get(url, get_headers())
114
+ files = []
115
+ body = JSON.parse(response.body)
116
+ body['results'].each do |file|
117
+ files << Components::LibraryFile.create(file)
121
118
  end
119
+ Components::ResultSet.new(files, body['meta'])
120
+ end
122
121
 
123
122
 
124
- # Permanently deletes all files in the Trash folder
125
- # @return [Boolean]
126
- def delete_library_trash()
127
- url = Util::Config.get('endpoints.base_url') + Util::Config.get('endpoints.library_folder_trash')
128
- url = build_url(url)
129
- response = RestClient.delete(url, get_headers())
130
- response.code == 204
131
- end
123
+ # Permanently deletes all files in the Trash folder
124
+ # @return [Boolean]
125
+ def delete_library_trash()
126
+ url = Util::Config.get('endpoints.base_url') + Util::Config.get('endpoints.library_folder_trash')
127
+ url = build_url(url)
128
+ response = RestClient.delete(url, get_headers())
129
+ response.code == 204
130
+ end
132
131
 
133
132
 
134
- # Retrieve a collection of MyLibrary files in the Constant Contact account
135
- # @param [Hash] params - hash of query parameters and values to append to the request.
136
- # Allowed parameters include:
137
- # type - Specifies the type of files to retrieve, valid values are : ALL, IMAGES, or DOCUMENTS
138
- # source - Specifies to retrieve files from a particular source, valid values are :
139
- # ALL - (default) files from all sources
140
- # MyComputer
141
- # StockImage
142
- # Facebook
143
- # Instagram
144
- # Shutterstock
145
- # Mobile
146
- # limit - Specifies the number of results displayed per page of output, from 1 - 1000, default = 50.
147
- # @return [ResultSet<LibraryFile>]
148
- def get_library_files(params = {})
149
- url = Util::Config.get('endpoints.base_url') + Util::Config.get('endpoints.library_files')
150
- url = build_url(url, params)
151
- response = RestClient.get(url, get_headers())
152
- files = []
153
- body = JSON.parse(response.body)
154
- body['results'].each do |file|
155
- files << Components::LibraryFile.create(file)
156
- end
157
- Components::ResultSet.new(files, body['meta'])
133
+ # Retrieve a collection of MyLibrary files in the Constant Contact account
134
+ # @param [Hash] params - hash of query parameters and values to append to the request.
135
+ # Allowed parameters include:
136
+ # type - Specifies the type of files to retrieve, valid values are : ALL, IMAGES, or DOCUMENTS
137
+ # source - Specifies to retrieve files from a particular source, valid values are :
138
+ # ALL - (default) files from all sources
139
+ # MyComputer
140
+ # StockImage
141
+ # Facebook
142
+ # Instagram
143
+ # Shutterstock
144
+ # Mobile
145
+ # limit - Specifies the number of results displayed per page of output, from 1 - 1000, default = 50.
146
+ # @return [ResultSet<LibraryFile>]
147
+ def get_library_files(params = {})
148
+ url = Util::Config.get('endpoints.base_url') + Util::Config.get('endpoints.library_files')
149
+ url = build_url(url, params)
150
+ response = RestClient.get(url, get_headers())
151
+ files = []
152
+ body = JSON.parse(response.body)
153
+ body['results'].each do |file|
154
+ files << Components::LibraryFile.create(file)
158
155
  end
156
+ Components::ResultSet.new(files, body['meta'])
157
+ end
159
158
 
160
159
 
161
- # Retrieves all files from a MyLibrary folder specified by the folder_id path parameter
162
- # @param [String] folder_id - Specifies the folder from which to retrieve files
163
- # @param [Hash] params - hash of query parameters and values to append to the request.
164
- # Allowed parameters include:
165
- # limit - Specifies the number of results displayed per page of output, from 1 - 50, default = 50.
166
- # @return [ResultSet<LibraryFile>]
167
- def get_library_files_by_folder(folder_id, params = {})
168
- url = Util::Config.get('endpoints.base_url') +
169
- sprintf(Util::Config.get('endpoints.library_files_by_folder'), folder_id)
170
- url = build_url(url, params)
171
- response = RestClient.get(url, get_headers())
172
- files = []
173
- body = JSON.parse(response.body)
174
- body['results'].each do |file|
175
- files << Components::LibraryFile.create(file)
176
- end
177
- Components::ResultSet.new(files, body['meta'])
160
+ # Retrieves all files from a MyLibrary folder specified by the folder_id path parameter
161
+ # @param [String] folder_id - Specifies the folder from which to retrieve files
162
+ # @param [Hash] params - hash of query parameters and values to append to the request.
163
+ # Allowed parameters include:
164
+ # limit - Specifies the number of results displayed per page of output, from 1 - 50, default = 50.
165
+ # @return [ResultSet<LibraryFile>]
166
+ def get_library_files_by_folder(folder_id, params = {})
167
+ url = Util::Config.get('endpoints.base_url') +
168
+ sprintf(Util::Config.get('endpoints.library_files_by_folder'), folder_id)
169
+ url = build_url(url, params)
170
+ response = RestClient.get(url, get_headers())
171
+ files = []
172
+ body = JSON.parse(response.body)
173
+ body['results'].each do |file|
174
+ files << Components::LibraryFile.create(file)
178
175
  end
176
+ Components::ResultSet.new(files, body['meta'])
177
+ end
179
178
 
180
179
 
181
- # Retrieve a MyLibrary file using the file_id path parameter
182
- # @param [String] file_id - Specifies the MyLibrary file for which to retrieve information
183
- # @return [LibraryFile]
184
- def get_library_file(file_id)
185
- url = Util::Config.get('endpoints.base_url') + sprintf(Util::Config.get('endpoints.library_file'), file_id)
186
- url = build_url(url)
187
- response = RestClient.get(url, get_headers())
188
- Components::LibraryFile.create(JSON.parse(response.body))
189
- end
180
+ # Retrieve a MyLibrary file using the file_id path parameter
181
+ # @param [String] file_id - Specifies the MyLibrary file for which to retrieve information
182
+ # @return [LibraryFile]
183
+ def get_library_file(file_id)
184
+ url = Util::Config.get('endpoints.base_url') + sprintf(Util::Config.get('endpoints.library_file'), file_id)
185
+ url = build_url(url)
186
+ response = RestClient.get(url, get_headers())
187
+ Components::LibraryFile.create(JSON.parse(response.body))
188
+ end
190
189
 
191
190
 
192
- # Adds a new MyLibrary file using the multipart content-type
193
- # @param [String] file_name - The name of the file (ie: dinnerplate-special.jpg)
194
- # @param [String] folder_id - Folder id to add the file to
195
- # @param [String] description - The description of the file provided by user
196
- # @param [String] source - indicates the source of the original file;
197
- # image files can be uploaded from the following sources :
198
- # MyComputer, StockImage, Facebook - MyLibrary Plus customers only,
199
- # Instagram - MyLibrary Plus customers only, Shutterstock, Mobile
200
- # @param [String] file_type - Specifies the file type, valid values are: JPEG, JPG, GIF, PDF, PNG
201
- # @param [String] contents - The content of the file
202
- # @return [LibraryFile]
203
- def add_library_file(file_name, folder_id, description, source, file_type, contents)
204
- url = Util::Config.get('endpoints.base_url') + Util::Config.get('endpoints.library_files')
205
- url = build_url(url)
206
-
207
- payload = { :file_name => file_name, :folder_id => folder_id,
208
- :description => description, :source => source, :file_type => file_type,
209
- :data => contents, :multipart => true }
210
-
211
- response = RestClient.post(url, payload, get_headers())
212
- location = response.headers[:location] || ''
213
- location.split('/').last
214
- end
191
+ # Adds a new MyLibrary file using the multipart content-type
192
+ # @param [String] file_name - The name of the file (ie: dinnerplate-special.jpg)
193
+ # @param [String] folder_id - Folder id to add the file to
194
+ # @param [String] description - The description of the file provided by user
195
+ # @param [String] source - indicates the source of the original file;
196
+ # image files can be uploaded from the following sources :
197
+ # MyComputer, StockImage, Facebook - MyLibrary Plus customers only,
198
+ # Instagram - MyLibrary Plus customers only, Shutterstock, Mobile
199
+ # @param [String] file_type - Specifies the file type, valid values are: JPEG, JPG, GIF, PDF, PNG
200
+ # @param [String] contents - The content of the file
201
+ # @return [LibraryFile]
202
+ def add_library_file(file_name, folder_id, description, source, file_type, contents)
203
+ url = Util::Config.get('endpoints.base_url') + Util::Config.get('endpoints.library_files')
204
+ url = build_url(url)
205
+
206
+ payload = { :file_name => file_name, :folder_id => folder_id,
207
+ :description => description, :source => source, :file_type => file_type,
208
+ :data => contents, :multipart => true }
209
+
210
+ response = RestClient.post(url, payload, get_headers())
211
+ location = response.headers[:location] || ''
212
+ location.split('/').last
213
+ end
215
214
 
216
215
 
217
- # Update information for a specific MyLibrary file
218
- # @param [LibraryFile] file - Library File to be updated
219
- # @return [LibraryFile]
220
- def update_library_file(file)
221
- url = Util::Config.get('endpoints.base_url') + sprintf(Util::Config.get('endpoints.library_file'), file.id)
222
- url = build_url(url)
223
- payload = file.to_json
224
- response = RestClient.put(url, payload, get_headers())
225
- Components::LibraryFile.create(JSON.parse(response.body))
226
- end
216
+ # Update information for a specific MyLibrary file
217
+ # @param [LibraryFile] file - Library File to be updated
218
+ # @return [LibraryFile]
219
+ def update_library_file(file)
220
+ url = Util::Config.get('endpoints.base_url') + sprintf(Util::Config.get('endpoints.library_file'), file.id)
221
+ url = build_url(url)
222
+ payload = file.to_json
223
+ response = RestClient.put(url, payload, get_headers())
224
+ Components::LibraryFile.create(JSON.parse(response.body))
225
+ end
227
226
 
228
227
 
229
- # Delete one or more MyLibrary files specified by the fileId path parameter;
230
- # separate multiple file IDs with a comma.
231
- # Deleted files are moved from their current folder into the system Trash folder, and its status is set to Deleted.
232
- # @param [String] file_id - Specifies the MyLibrary file to delete
233
- # @return [Boolean]
234
- def delete_library_file(file_id)
235
- url = Util::Config.get('endpoints.base_url') + sprintf(Util::Config.get('endpoints.library_file'), file_id)
236
- url = build_url(url)
237
- response = RestClient.delete(url, get_headers())
238
- response.code == 204
239
- end
228
+ # Delete one or more MyLibrary files specified by the fileId path parameter;
229
+ # separate multiple file IDs with a comma.
230
+ # Deleted files are moved from their current folder into the system Trash folder, and its status is set to Deleted.
231
+ # @param [String] file_id - Specifies the MyLibrary file to delete
232
+ # @return [Boolean]
233
+ def delete_library_file(file_id)
234
+ url = Util::Config.get('endpoints.base_url') + sprintf(Util::Config.get('endpoints.library_file'), file_id)
235
+ url = build_url(url)
236
+ response = RestClient.delete(url, get_headers())
237
+ response.code == 204
238
+ end
240
239
 
241
240
 
242
- # Retrieve the upload status for one or more MyLibrary files using the file_id path parameter;
243
- # separate multiple file IDs with a comma
244
- # @param [String] file_id - Specifies the files for which to retrieve upload status information
245
- # @return [Array<UploadStatus>]
246
- def get_library_files_upload_status(file_id)
247
- url = Util::Config.get('endpoints.base_url') +
248
- sprintf(Util::Config.get('endpoints.library_file_upload_status'), file_id)
249
- url = build_url(url)
250
- response = RestClient.get(url, get_headers())
251
- statuses = []
252
- JSON.parse(response.body).each do |status|
253
- statuses << Components::UploadStatus.create(status)
254
- end
255
- statuses
241
+ # Retrieve the upload status for one or more MyLibrary files using the file_id path parameter;
242
+ # separate multiple file IDs with a comma
243
+ # @param [String] file_id - Specifies the files for which to retrieve upload status information
244
+ # @return [Array<UploadStatus>]
245
+ def get_library_files_upload_status(file_id)
246
+ url = Util::Config.get('endpoints.base_url') +
247
+ sprintf(Util::Config.get('endpoints.library_file_upload_status'), file_id)
248
+ url = build_url(url)
249
+ response = RestClient.get(url, get_headers())
250
+ statuses = []
251
+ JSON.parse(response.body).each do |status|
252
+ statuses << Components::UploadStatus.create(status)
256
253
  end
254
+ statuses
255
+ end
257
256
 
258
257
 
259
- # Move one or more MyLibrary files to a different folder in the user's account
260
- # specify the destination folder using the folder_id path parameter.
261
- # @param [String] folder_id - Specifies the destination MyLibrary folder to which the files will be moved
262
- # @param [String] file_id - Specifies the files to move, in a string of comma separated file ids (e.g. 8,9)
263
- # @return [Array<MoveResults>]
264
- def move_library_files(folder_id, file_id)
265
- url = Util::Config.get('endpoints.base_url') +
266
- sprintf(Util::Config.get('endpoints.library_file_move'), folder_id)
267
- url = build_url(url)
268
-
269
- payload = file_id.split(',').map {|id| id.strip}.to_json
270
- response = RestClient.put(url, payload, get_headers())
271
- results = []
272
- JSON.parse(response.body).each do |result|
273
- results << Components::MoveResults.create(result)
274
- end
275
- results
258
+ # Move one or more MyLibrary files to a different folder in the user's account
259
+ # specify the destination folder using the folder_id path parameter.
260
+ # @param [String] folder_id - Specifies the destination MyLibrary folder to which the files will be moved
261
+ # @param [String] file_id - Specifies the files to move, in a string of comma separated file ids (e.g. 8,9)
262
+ # @return [Array<MoveResults>]
263
+ def move_library_files(folder_id, file_id)
264
+ url = Util::Config.get('endpoints.base_url') +
265
+ sprintf(Util::Config.get('endpoints.library_file_move'), folder_id)
266
+ url = build_url(url)
267
+
268
+ payload = file_id.split(',').map {|id| id.strip}.to_json
269
+ response = RestClient.put(url, payload, get_headers())
270
+ results = []
271
+ JSON.parse(response.body).each do |result|
272
+ results << Components::MoveResults.create(result)
276
273
  end
277
-
274
+ results
278
275
  end
276
+
279
277
  end
280
278
  end
281
279
  end