contentful-management 1.10.1 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (303) hide show
  1. checksums.yaml +5 -5
  2. data/.rubocop.yml +3 -0
  3. data/CHANGELOG.md +48 -0
  4. data/README.md +92 -50
  5. data/lib/contentful/management/api_key.rb +25 -2
  6. data/lib/contentful/management/array.rb +3 -3
  7. data/lib/contentful/management/asset.rb +13 -8
  8. data/lib/contentful/management/client.rb +73 -60
  9. data/lib/contentful/management/client_api_key_methods_factory.rb +8 -0
  10. data/lib/contentful/management/client_asset_methods_factory.rb +0 -2
  11. data/lib/contentful/management/client_association_all_published_method_factory.rb +2 -3
  12. data/lib/contentful/management/client_association_methods_factory.rb +9 -9
  13. data/lib/contentful/management/client_content_type_methods_factory.rb +8 -2
  14. data/lib/contentful/management/client_editor_interface_methods_factory.rb +12 -6
  15. data/lib/contentful/management/client_entry_methods_factory.rb +1 -3
  16. data/lib/contentful/management/client_environment_methods_factory.rb +59 -0
  17. data/lib/contentful/management/client_organization_methods_factory.rb +1 -1
  18. data/lib/contentful/management/client_personal_access_tokens_methods_factory.rb +3 -3
  19. data/lib/contentful/management/client_role_methods_factory.rb +8 -0
  20. data/lib/contentful/management/client_snapshot_methods_factory.rb +8 -6
  21. data/lib/contentful/management/client_space_methods_factory.rb +2 -6
  22. data/lib/contentful/management/client_upload_methods_factory.rb +8 -0
  23. data/lib/contentful/management/client_user_methods_factory.rb +1 -1
  24. data/lib/contentful/management/client_webhook_call_methods_factory.rb +11 -6
  25. data/lib/contentful/management/client_webhook_health_methods_factory.rb +2 -2
  26. data/lib/contentful/management/client_webhook_methods_factory.rb +8 -0
  27. data/lib/contentful/management/content_type.rb +9 -7
  28. data/lib/contentful/management/content_type_editor_interface_methods_factory.rb +7 -3
  29. data/lib/contentful/management/content_type_entry_methods_factory.rb +2 -2
  30. data/lib/contentful/management/content_type_snapshot_methods_factory.rb +16 -2
  31. data/lib/contentful/management/dynamic_entry.rb +1 -1
  32. data/lib/contentful/management/editor_interface.rb +14 -6
  33. data/lib/contentful/management/entry.rb +12 -10
  34. data/lib/contentful/management/entry_association_methods_factory.rb +2 -2
  35. data/lib/contentful/management/environment.rb +138 -0
  36. data/lib/contentful/management/environment_asset_methods_factory.rb +11 -0
  37. data/lib/contentful/management/environment_association_methods_factory.rb +42 -0
  38. data/lib/contentful/management/environment_content_type_methods_factory.rb +11 -0
  39. data/lib/contentful/management/environment_editor_interface_methods_factory.rb +15 -0
  40. data/lib/contentful/management/environment_entry_methods_factory.rb +11 -0
  41. data/lib/contentful/management/environment_locale_methods_factory.rb +11 -0
  42. data/lib/contentful/management/environment_ui_extension_methods_factory.rb +11 -0
  43. data/lib/contentful/management/field.rb +3 -3
  44. data/lib/contentful/management/file.rb +2 -2
  45. data/lib/contentful/management/link.rb +21 -7
  46. data/lib/contentful/management/locale.rb +4 -2
  47. data/lib/contentful/management/organization.rb +1 -1
  48. data/lib/contentful/management/personal_access_token.rb +2 -2
  49. data/lib/contentful/management/resource.rb +34 -13
  50. data/lib/contentful/management/resource/all_published.rb +2 -2
  51. data/lib/contentful/management/resource/archiver.rb +12 -2
  52. data/lib/contentful/management/resource/environment_aware.rb +13 -0
  53. data/lib/contentful/management/resource/publisher.rb +12 -2
  54. data/lib/contentful/management/resource/refresher.rb +1 -1
  55. data/lib/contentful/management/resource_builder.rb +16 -14
  56. data/lib/contentful/management/response.rb +1 -1
  57. data/lib/contentful/management/role.rb +29 -2
  58. data/lib/contentful/management/snapshot.rb +13 -7
  59. data/lib/contentful/management/space.rb +14 -93
  60. data/lib/contentful/management/space_association_methods_factory.rb +1 -1
  61. data/lib/contentful/management/{space_locale_methods_factory.rb → space_environment_methods_factory.rb} +2 -6
  62. data/lib/contentful/management/space_membership.rb +3 -3
  63. data/lib/contentful/management/ui_extension.rb +4 -2
  64. data/lib/contentful/management/upload.rb +24 -1
  65. data/lib/contentful/management/user.rb +4 -4
  66. data/lib/contentful/management/validation.rb +5 -5
  67. data/lib/contentful/management/version.rb +1 -1
  68. data/lib/contentful/management/webhook.rb +26 -3
  69. data/lib/contentful/management/webhook_call.rb +8 -8
  70. data/lib/contentful/management/webhook_health.rb +2 -2
  71. data/spec/fixtures/vcr_cassettes/asset/143_assets_next_page.yml +2 -2
  72. data/spec/fixtures/vcr_cassettes/asset/all.yml +1 -1
  73. data/spec/fixtures/vcr_cassettes/asset/archive.yml +2 -2
  74. data/spec/fixtures/vcr_cassettes/asset/archive_published.yml +2 -2
  75. data/spec/fixtures/vcr_cassettes/asset/archived_false.yml +2 -2
  76. data/spec/fixtures/vcr_cassettes/asset/archived_true.yml +2 -2
  77. data/spec/fixtures/vcr_cassettes/asset/create.yml +2 -2
  78. data/spec/fixtures/vcr_cassettes/asset/create_with_already_used_id.yml +1 -1
  79. data/spec/fixtures/vcr_cassettes/asset/create_with_custom_id.yml +2 -2
  80. data/spec/fixtures/vcr_cassettes/asset/create_with_locale.yml +2 -2
  81. data/spec/fixtures/vcr_cassettes/asset/destroy.yml +2 -2
  82. data/spec/fixtures/vcr_cassettes/asset/destroy_published.yml +2 -2
  83. data/spec/fixtures/vcr_cassettes/asset/find.yml +1 -1
  84. data/spec/fixtures/vcr_cassettes/asset/find_not_found.yml +1 -1
  85. data/spec/fixtures/vcr_cassettes/asset/limited_assets_next_page.yml +2 -2
  86. data/spec/fixtures/vcr_cassettes/asset/locale.yml +1 -1
  87. data/spec/fixtures/vcr_cassettes/asset/process.yml +2 -2
  88. data/spec/fixtures/vcr_cassettes/asset/publish.yml +2 -2
  89. data/spec/fixtures/vcr_cassettes/asset/publish_after_create.yml +3 -3
  90. data/spec/fixtures/vcr_cassettes/asset/publish_already_published.yml +2 -2
  91. data/spec/fixtures/vcr_cassettes/asset/published_false.yml +2 -2
  92. data/spec/fixtures/vcr_cassettes/asset/published_true.yml +2 -2
  93. data/spec/fixtures/vcr_cassettes/asset/reload.yml +4 -4
  94. data/spec/fixtures/vcr_cassettes/asset/reload_with_fields.yml +2 -2
  95. data/spec/fixtures/vcr_cassettes/asset/save_update.yml +2 -2
  96. data/spec/fixtures/vcr_cassettes/asset/select_operator.yml +1 -1
  97. data/spec/fixtures/vcr_cassettes/asset/set_locale.yml +1 -1
  98. data/spec/fixtures/vcr_cassettes/asset/unarchive.yml +2 -2
  99. data/spec/fixtures/vcr_cassettes/asset/unarchive_already_unarchive.yml +2 -2
  100. data/spec/fixtures/vcr_cassettes/asset/unarchive_already_unarchived.yml +2 -2
  101. data/spec/fixtures/vcr_cassettes/asset/unpublish.yml +2 -2
  102. data/spec/fixtures/vcr_cassettes/asset/unpublish_already_unpublished.yml +2 -2
  103. data/spec/fixtures/vcr_cassettes/asset/update_file.yml +2 -2
  104. data/spec/fixtures/vcr_cassettes/asset/update_to_specified_locale.yml +2 -2
  105. data/spec/fixtures/vcr_cassettes/asset/update_with_default_locale_without_file.yml +2 -2
  106. data/spec/fixtures/vcr_cassettes/content_type/activate.yml +2 -2
  107. data/spec/fixtures/vcr_cassettes/content_type/activate_with_invalid_version.yml +2 -2
  108. data/spec/fixtures/vcr_cassettes/content_type/activated_false.yml +2 -2
  109. data/spec/fixtures/vcr_cassettes/content_type/activated_true.yml +2 -2
  110. data/spec/fixtures/vcr_cassettes/content_type/all.yml +1 -1
  111. data/spec/fixtures/vcr_cassettes/content_type/all_public.yml +1 -1
  112. data/spec/fixtures/vcr_cassettes/content_type/create.yml +1 -1
  113. data/spec/fixtures/vcr_cassettes/content_type/create_content_type_with_id.yml +1 -1
  114. data/spec/fixtures/vcr_cassettes/content_type/create_with_Array_field.yml +1 -1
  115. data/spec/fixtures/vcr_cassettes/content_type/create_with_Boolean_field.yml +1 -1
  116. data/spec/fixtures/vcr_cassettes/content_type/create_with_Date_field.yml +1 -1
  117. data/spec/fixtures/vcr_cassettes/content_type/create_with_Integer_field.yml +1 -1
  118. data/spec/fixtures/vcr_cassettes/content_type/create_with_Link_field.yml +1 -1
  119. data/spec/fixtures/vcr_cassettes/content_type/create_with_Location_field.yml +1 -1
  120. data/spec/fixtures/vcr_cassettes/content_type/create_with_Number_field.yml +1 -1
  121. data/spec/fixtures/vcr_cassettes/content_type/create_with_Object_field.yml +1 -1
  122. data/spec/fixtures/vcr_cassettes/content_type/create_with_Symbol_field.yml +1 -1
  123. data/spec/fixtures/vcr_cassettes/content_type/create_with_Text_field.yml +1 -1
  124. data/spec/fixtures/vcr_cassettes/content_type/deactivate.yml +2 -2
  125. data/spec/fixtures/vcr_cassettes/content_type/deactivate_already_deactivated.yml +2 -2
  126. data/spec/fixtures/vcr_cassettes/content_type/deactivate_with_entries.yml +2 -2
  127. data/spec/fixtures/vcr_cassettes/content_type/deactivate_with_version_change.yml +2 -2
  128. data/spec/fixtures/vcr_cassettes/content_type/destroy.yml +2 -2
  129. data/spec/fixtures/vcr_cassettes/content_type/destroy_activated.yml +2 -2
  130. data/spec/fixtures/vcr_cassettes/content_type/entry/all.yml +4 -4
  131. data/spec/fixtures/vcr_cassettes/content_type/entry/create.yml +4 -4
  132. data/spec/fixtures/vcr_cassettes/content_type/entry/create_only_with_localized_fields.yml +2 -2
  133. data/spec/fixtures/vcr_cassettes/content_type/entry/create_to_single_locale_only_with_localized_fields.yml +2 -2
  134. data/spec/fixtures/vcr_cassettes/content_type/entry/create_with_camel_case_id_to_multiple_locales.yml +2 -2
  135. data/spec/fixtures/vcr_cassettes/content_type/entry/create_with_entries.yml +3 -3
  136. data/spec/fixtures/vcr_cassettes/content_type/entry/create_with_entries_for_multiple_locales.yml +9 -9
  137. data/spec/fixtures/vcr_cassettes/content_type/entry/create_with_multiple_locales.yml +2 -2
  138. data/spec/fixtures/vcr_cassettes/content_type/entry/update_only_with_localized_fields.yml +3 -3
  139. data/spec/fixtures/vcr_cassettes/content_type/fields/add.yml +2 -2
  140. data/spec/fixtures/vcr_cassettes/content_type/fields/create.yml +2 -2
  141. data/spec/fixtures/vcr_cassettes/content_type/fields/create_array_types.yml +3 -3
  142. data/spec/fixtures/vcr_cassettes/content_type/fields/create_array_with_params.yml +2 -2
  143. data/spec/fixtures/vcr_cassettes/content_type/fields/create_with_params.yml +2 -2
  144. data/spec/fixtures/vcr_cassettes/content_type/fields/destroy.yml +2 -2
  145. data/spec/fixtures/vcr_cassettes/content_type/fields/update_field.yml +2 -2
  146. data/spec/fixtures/vcr_cassettes/content_type/find.yml +1 -1
  147. data/spec/fixtures/vcr_cassettes/content_type/find_not_found.yml +1 -1
  148. data/spec/fixtures/vcr_cassettes/content_type/issue_79.yml +3 -3
  149. data/spec/fixtures/vcr_cassettes/content_type/omitted_field.yml +4 -4
  150. data/spec/fixtures/vcr_cassettes/content_type/reload.yml +4 -4
  151. data/spec/fixtures/vcr_cassettes/content_type/save_new.yml +3 -3
  152. data/spec/fixtures/vcr_cassettes/content_type/save_updated.yml +2 -2
  153. data/spec/fixtures/vcr_cassettes/content_type/save_with_added_field.yml +2 -2
  154. data/spec/fixtures/vcr_cassettes/content_type/update.yml +2 -2
  155. data/spec/fixtures/vcr_cassettes/content_type/update_change_field_name.yml +2 -2
  156. data/spec/fixtures/vcr_cassettes/content_type/update_remove_field.yml +2 -2
  157. data/spec/fixtures/vcr_cassettes/content_type/update_with_fields.yml +2 -2
  158. data/spec/fixtures/vcr_cassettes/content_type/update_with_one_new_field.yml +2 -2
  159. data/spec/fixtures/vcr_cassettes/content_type/validation/in.yml +3 -3
  160. data/spec/fixtures/vcr_cassettes/content_type/validation/in_add.yml +3 -3
  161. data/spec/fixtures/vcr_cassettes/content_type/validation/in_update.yml +3 -3
  162. data/spec/fixtures/vcr_cassettes/content_type/validation/link_content_type.yml +3 -3
  163. data/spec/fixtures/vcr_cassettes/content_type/validation/link_field.yml +3 -3
  164. data/spec/fixtures/vcr_cassettes/content_type/validation/link_mimetype_group.yml +3 -3
  165. data/spec/fixtures/vcr_cassettes/content_type/validation/multiple_add.yml +3 -3
  166. data/spec/fixtures/vcr_cassettes/content_type/validation/present.yml +3 -3
  167. data/spec/fixtures/vcr_cassettes/content_type/validation/range.yml +3 -3
  168. data/spec/fixtures/vcr_cassettes/content_type/validation/range_update.yml +3 -3
  169. data/spec/fixtures/vcr_cassettes/content_type/validation/regexp.yml +3 -3
  170. data/spec/fixtures/vcr_cassettes/content_type/validation/size.yml +3 -3
  171. data/spec/fixtures/vcr_cassettes/content_type/validation/unique.yml +3 -3
  172. data/spec/fixtures/vcr_cassettes/editor_interfaces/default_for_space.yml +1 -1
  173. data/spec/fixtures/vcr_cassettes/editor_interfaces/update.yml +3 -3
  174. data/spec/fixtures/vcr_cassettes/entry/all.yml +1 -1
  175. data/spec/fixtures/vcr_cassettes/entry/archive.yml +2 -2
  176. data/spec/fixtures/vcr_cassettes/entry/archive_published.yml +2 -2
  177. data/spec/fixtures/vcr_cassettes/entry/archived_false.yml +2 -2
  178. data/spec/fixtures/vcr_cassettes/entry/archived_true.yml +2 -2
  179. data/spec/fixtures/vcr_cassettes/entry/content_type_entires.yml +1 -1
  180. data/spec/fixtures/vcr_cassettes/entry/create.yml +4 -4
  181. data/spec/fixtures/vcr_cassettes/entry/create_with_asset.yml +3 -3
  182. data/spec/fixtures/vcr_cassettes/entry/create_with_assets.yml +3 -3
  183. data/spec/fixtures/vcr_cassettes/entry/create_with_custom_id.yml +2 -2
  184. data/spec/fixtures/vcr_cassettes/entry/create_with_entries.yml +3 -3
  185. data/spec/fixtures/vcr_cassettes/entry/create_with_entry.yml +3 -3
  186. data/spec/fixtures/vcr_cassettes/entry/create_with_just_id.yml +4 -4
  187. data/spec/fixtures/vcr_cassettes/entry/create_with_location.yml +2 -2
  188. data/spec/fixtures/vcr_cassettes/entry/create_with_specified_locale.yml +3 -3
  189. data/spec/fixtures/vcr_cassettes/entry/create_with_symbols.yml +2 -2
  190. data/spec/fixtures/vcr_cassettes/entry/destory_published.yml +2 -2
  191. data/spec/fixtures/vcr_cassettes/entry/destroy.yml +2 -2
  192. data/spec/fixtures/vcr_cassettes/entry/fallback_undefined.yml +3 -3
  193. data/spec/fixtures/vcr_cassettes/entry/find-with-null-symbols.yml +2 -2
  194. data/spec/fixtures/vcr_cassettes/entry/find.yml +1 -1
  195. data/spec/fixtures/vcr_cassettes/entry/find_not_found.yml +1 -1
  196. data/spec/fixtures/vcr_cassettes/entry/issue_61_1.yml +6 -6
  197. data/spec/fixtures/vcr_cassettes/entry/issue_61_2.yml +6 -6
  198. data/spec/fixtures/vcr_cassettes/entry/issue_61_3.yml +6 -6
  199. data/spec/fixtures/vcr_cassettes/entry/issue_61_4.yml +6 -6
  200. data/spec/fixtures/vcr_cassettes/entry/issue_61_5.yml +305 -198
  201. data/spec/fixtures/vcr_cassettes/entry/issue_61_6.yml +5 -5
  202. data/spec/fixtures/vcr_cassettes/entry/issue_61_7.yml +6 -6
  203. data/spec/fixtures/vcr_cassettes/entry/issue_61_8.yml +6 -6
  204. data/spec/fixtures/vcr_cassettes/entry/issue_61_spaces.yml +143 -188
  205. data/spec/fixtures/vcr_cassettes/entry/issue_70.yml +3 -3
  206. data/spec/fixtures/vcr_cassettes/entry/issue_73.yml +4 -4
  207. data/spec/fixtures/vcr_cassettes/entry/issue_91.yml +2 -2
  208. data/spec/fixtures/vcr_cassettes/entry/limited_entries.yml +2 -2
  209. data/spec/fixtures/vcr_cassettes/entry/locales/fallback_to_default_locale.yml +2 -2
  210. data/spec/fixtures/vcr_cassettes/entry/locales/retrieve_localized.yml +2 -2
  211. data/spec/fixtures/vcr_cassettes/entry/locales/simple_assignments_use_default_locale.yml +2 -2
  212. data/spec/fixtures/vcr_cassettes/entry/locales/simple_assignments_use_specified_locale.yml +2 -2
  213. data/spec/fixtures/vcr_cassettes/entry/publish.yml +2 -2
  214. data/spec/fixtures/vcr_cassettes/entry/publish_already_published.yml +2 -2
  215. data/spec/fixtures/vcr_cassettes/entry/published_false.yml +2 -2
  216. data/spec/fixtures/vcr_cassettes/entry/published_true.yml +2 -2
  217. data/spec/fixtures/vcr_cassettes/entry/reload.yml +6 -6
  218. data/spec/fixtures/vcr_cassettes/entry/save_update.yml +2 -2
  219. data/spec/fixtures/vcr_cassettes/entry/search_filter/equality_operator.yml +2 -2
  220. data/spec/fixtures/vcr_cassettes/entry/search_filter/exclusion_operator.yml +2 -2
  221. data/spec/fixtures/vcr_cassettes/entry/search_filter/full_search.yml +2 -2
  222. data/spec/fixtures/vcr_cassettes/entry/search_filter/full_search_match_operator.yml +2 -2
  223. data/spec/fixtures/vcr_cassettes/entry/search_filter/including_linked_entries.yml +2 -2
  224. data/spec/fixtures/vcr_cassettes/entry/search_filter/inclusion_operator.yml +2 -2
  225. data/spec/fixtures/vcr_cassettes/entry/search_filter/inequality_operator.yml +2 -2
  226. data/spec/fixtures/vcr_cassettes/entry/search_filter/location_search_near_operator.yml +2 -2
  227. data/spec/fixtures/vcr_cassettes/entry/search_filter/location_search_within_operator.yml +2 -2
  228. data/spec/fixtures/vcr_cassettes/entry/search_filter/matching_array_fields.yml +2 -2
  229. data/spec/fixtures/vcr_cassettes/entry/search_filter/order_sys_createdAt.yml +2 -2
  230. data/spec/fixtures/vcr_cassettes/entry/search_filter/order_sys_updatedAt.yml +2 -2
  231. data/spec/fixtures/vcr_cassettes/entry/search_filter/range_operators_greater_than_or_equal.yml +2 -2
  232. data/spec/fixtures/vcr_cassettes/entry/search_filter/range_operators_less.yml +2 -2
  233. data/spec/fixtures/vcr_cassettes/entry/search_filter/reverse_order_sys_updatedAt.yml +2 -2
  234. data/spec/fixtures/vcr_cassettes/entry/select_operator.yml +1 -1
  235. data/spec/fixtures/vcr_cassettes/entry/service_unavailable.yml +1 -1
  236. data/spec/fixtures/vcr_cassettes/entry/too_many_requests.yml +5 -5
  237. data/spec/fixtures/vcr_cassettes/entry/too_many_requests_retry.yml +6 -6
  238. data/spec/fixtures/vcr_cassettes/entry/unarchive.yml +2 -2
  239. data/spec/fixtures/vcr_cassettes/entry/unarchive_already_unarchived.yml +2 -2
  240. data/spec/fixtures/vcr_cassettes/entry/unpublish.yml +2 -2
  241. data/spec/fixtures/vcr_cassettes/entry/unpublish_already_unpublished.yml +2 -2
  242. data/spec/fixtures/vcr_cassettes/entry/update.yml +4 -4
  243. data/spec/fixtures/vcr_cassettes/entry/update_bool_field.yml +4 -4
  244. data/spec/fixtures/vcr_cassettes/entry/update_unlocalized_field.yml +3 -3
  245. data/spec/fixtures/vcr_cassettes/entry/update_with_custom_locale.yml +3 -3
  246. data/spec/fixtures/vcr_cassettes/environment/all.yml +226 -0
  247. data/spec/fixtures/vcr_cassettes/environment/create.yml +155 -0
  248. data/spec/fixtures/vcr_cassettes/environment/destroy.yml +89 -0
  249. data/spec/fixtures/vcr_cassettes/environment/find.yml +155 -0
  250. data/spec/fixtures/vcr_cassettes/environment/find_2.yml +155 -0
  251. data/spec/fixtures/vcr_cassettes/environment/not_found.yml +98 -0
  252. data/spec/fixtures/vcr_cassettes/locale/all_for_space.yml +1 -1
  253. data/spec/fixtures/vcr_cassettes/locale/create_for_space.yml +2 -2
  254. data/spec/fixtures/vcr_cassettes/locale/destroy.yml +5 -5
  255. data/spec/fixtures/vcr_cassettes/locale/fallback_code.yml +3 -3
  256. data/spec/fixtures/vcr_cassettes/locale/find.yml +1 -1
  257. data/spec/fixtures/vcr_cassettes/locale/find_default.yml +1 -1
  258. data/spec/fixtures/vcr_cassettes/locale/find_for_space_not_found.yml +1 -1
  259. data/spec/fixtures/vcr_cassettes/locale/find_not_default.yml +1 -1
  260. data/spec/fixtures/vcr_cassettes/locale/find_not_optional.yml +1 -1
  261. data/spec/fixtures/vcr_cassettes/locale/find_optional.yml +1 -1
  262. data/spec/fixtures/vcr_cassettes/locale/reload.yml +3 -3
  263. data/spec/fixtures/vcr_cassettes/locale/update_both.yml +3 -3
  264. data/spec/fixtures/vcr_cassettes/locale/update_code.yml +3 -3
  265. data/spec/fixtures/vcr_cassettes/locale/update_name.yml +3 -3
  266. data/spec/fixtures/vcr_cassettes/snapshot/all.yml +1 -1
  267. data/spec/fixtures/vcr_cassettes/snapshot/ct_all.yml +1 -1
  268. data/spec/fixtures/vcr_cassettes/snapshot/ct_find.yml +1 -1
  269. data/spec/fixtures/vcr_cassettes/snapshot/ct_find_not_found.yml +1 -1
  270. data/spec/fixtures/vcr_cassettes/snapshot/find.yml +1 -1
  271. data/spec/fixtures/vcr_cassettes/snapshot/find_not_found.yml +1 -1
  272. data/spec/fixtures/vcr_cassettes/snapshot/properties.yml +2 -2
  273. data/spec/fixtures/vcr_cassettes/ui_extension/all.yml +1 -1
  274. data/spec/fixtures/vcr_cassettes/ui_extension/create.yml +1 -1
  275. data/spec/fixtures/vcr_cassettes/ui_extension/delete.yml +3 -3
  276. data/spec/fixtures/vcr_cassettes/ui_extension/find.yml +1 -1
  277. data/spec/fixtures/vcr_cassettes/upload/associate_with_asset.yml +3 -3
  278. data/spec/lib/contentful/management/api_key_spec.rb +7 -7
  279. data/spec/lib/contentful/management/asset_spec.rb +38 -57
  280. data/spec/lib/contentful/management/client_spec.rb +1 -1
  281. data/spec/lib/contentful/management/content_type_spec.rb +78 -78
  282. data/spec/lib/contentful/management/editor_interface_spec.rb +4 -4
  283. data/spec/lib/contentful/management/entry_spec.rb +104 -114
  284. data/spec/lib/contentful/management/environment_spec.rb +87 -0
  285. data/spec/lib/contentful/management/locale_spec.rb +22 -22
  286. data/spec/lib/contentful/management/role_spec.rb +11 -11
  287. data/spec/lib/contentful/management/snapshot_spec.rb +27 -27
  288. data/spec/lib/contentful/management/space_membership_spec.rb +6 -7
  289. data/spec/lib/contentful/management/space_spec.rb +0 -282
  290. data/spec/lib/contentful/management/ui_extension_spec.rb +8 -8
  291. data/spec/lib/contentful/management/upload_spec.rb +9 -9
  292. data/spec/lib/contentful/management/webhook_calls_spec.rb +6 -6
  293. data/spec/lib/contentful/management/webhook_health_spec.rb +3 -3
  294. data/spec/lib/contentful/management/webhook_spec.rb +14 -12
  295. metadata +28 -14
  296. data/lib/contentful/management/space_asset_methods_factory.rb +0 -13
  297. data/lib/contentful/management/space_association_all_published_method_factory.rb +0 -12
  298. data/lib/contentful/management/space_content_type_methods_factory.rb +0 -13
  299. data/lib/contentful/management/space_editor_interface_methods_factory.rb +0 -21
  300. data/lib/contentful/management/space_entry_methods_factory.rb +0 -21
  301. data/lib/contentful/management/space_ui_extension_methods_factory.rb +0 -15
  302. data/spec/fixtures/vcr_cassettes/asset/all_public.yml +0 -112
  303. data/spec/fixtures/vcr_cassettes/entry/all_public.yml +0 -102
@@ -2,7 +2,7 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: post
5
- uri: https://api.contentful.com/spaces/facgnwwgj5fe/extensions
5
+ uri: https://api.contentful.com/spaces/facgnwwgj5fe/environments/master/extensions
6
6
  body:
7
7
  encoding: UTF-8
8
8
  string: '{"extension":{"name":"test extension","fieldTypes":[{"type":"Symbol"},{"type":"Text"}],"srcdoc":"<!doctype
@@ -2,7 +2,7 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: get
5
- uri: https://api.contentful.com/spaces/facgnwwgj5fe/extensions/2rf6QdckyoECCsQeE6gIOg
5
+ uri: https://api.contentful.com/spaces/facgnwwgj5fe/environments/master/extensions/2rf6QdckyoECCsQeE6gIOg
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
@@ -125,7 +125,7 @@ http_interactions:
125
125
  recorded_at: Tue, 05 Sep 2017 12:18:10 GMT
126
126
  - request:
127
127
  method: delete
128
- uri: https://api.contentful.com/spaces/facgnwwgj5fe/extensions/2rf6QdckyoECCsQeE6gIOg
128
+ uri: https://api.contentful.com/spaces/facgnwwgj5fe/environments/master/extensions/2rf6QdckyoECCsQeE6gIOg
129
129
  body:
130
130
  encoding: US-ASCII
131
131
  string: ''
@@ -201,7 +201,7 @@ http_interactions:
201
201
  recorded_at: Tue, 05 Sep 2017 12:18:11 GMT
202
202
  - request:
203
203
  method: get
204
- uri: https://api.contentful.com/spaces/facgnwwgj5fe/extensions/2rf6QdckyoECCsQeE6gIOg
204
+ uri: https://api.contentful.com/spaces/facgnwwgj5fe/environments/master/extensions/2rf6QdckyoECCsQeE6gIOg
205
205
  body:
206
206
  encoding: US-ASCII
207
207
  string: ''
@@ -2,7 +2,7 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: get
5
- uri: https://api.contentful.com/spaces/arqlnkt58eul/extensions/2ZJduY1pKEma6G8Y2ImqYU
5
+ uri: https://api.contentful.com/spaces/arqlnkt58eul/environments/master/extensions/2ZJduY1pKEma6G8Y2ImqYU
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
@@ -84,7 +84,7 @@ http_interactions:
84
84
  recorded_at: Tue, 25 Apr 2017 14:00:57 GMT
85
85
  - request:
86
86
  method: post
87
- uri: https://api.contentful.com/spaces/facgnwwgj5fe/assets
87
+ uri: https://api.contentful.com/spaces/facgnwwgj5fe/environments/master/assets
88
88
  body:
89
89
  encoding: UTF-8
90
90
  string: '{"fields":{"title":{"en-US":"pixel"},"description":{"en-US":null},"file":{"en-US":{"contentType":"image/jpeg","fileName":"pixel","uploadFrom":{"sys":{"type":"Link","linkType":"Upload","id":"3oMzfmxT3R1OKI3KMSIN5D"}}}}}}'
@@ -213,7 +213,7 @@ http_interactions:
213
213
  recorded_at: Tue, 25 Apr 2017 14:01:02 GMT
214
214
  - request:
215
215
  method: put
216
- uri: https://api.contentful.com/spaces/facgnwwgj5fe/assets/3d7PVhU4w8kEWSy0WMCwoC/files/en-US/process
216
+ uri: https://api.contentful.com/spaces/facgnwwgj5fe/environments/master/assets/3d7PVhU4w8kEWSy0WMCwoC/files/en-US/process
217
217
  body:
218
218
  encoding: US-ASCII
219
219
  string: ''
@@ -293,7 +293,7 @@ http_interactions:
293
293
  recorded_at: Tue, 25 Apr 2017 14:01:03 GMT
294
294
  - request:
295
295
  method: get
296
- uri: https://api.contentful.com/spaces/facgnwwgj5fe/assets/3d7PVhU4w8kEWSy0WMCwoC
296
+ uri: https://api.contentful.com/spaces/facgnwwgj5fe/environments/master/assets/3d7PVhU4w8kEWSy0WMCwoC
297
297
  body:
298
298
  encoding: US-ASCII
299
299
  string: ''
@@ -11,17 +11,17 @@ module Contentful
11
11
 
12
12
  let!(:client) { Client.new(token) }
13
13
 
14
- subject { client.api_keys }
14
+ subject { client.api_keys(space_id) }
15
15
 
16
16
  describe '.all' do
17
17
  it 'class method also works' do
18
18
  vcr('api_key/all_for_space') { expect(Contentful::Management::ApiKey.all(client, space_id)).to be_kind_of Contentful::Management::Array }
19
19
  end
20
20
  it 'returns a Contentful::Array' do
21
- vcr('api_key/all_for_space') { expect(subject.all(space_id)).to be_kind_of Contentful::Management::Array }
21
+ vcr('api_key/all_for_space') { expect(subject.all).to be_kind_of Contentful::Management::Array }
22
22
  end
23
23
  it 'builds a Contentful::Management::ApiKey object' do
24
- vcr('api_key/all_for_space') { expect(subject.all(space_id).first).to be_kind_of Contentful::Management::ApiKey }
24
+ vcr('api_key/all_for_space') { expect(subject.all.first).to be_kind_of Contentful::Management::ApiKey }
25
25
  end
26
26
  end
27
27
 
@@ -30,18 +30,18 @@ module Contentful
30
30
  vcr('api_key/find') { expect(Contentful::Management::ApiKey.find(client, space_id, api_key_id)).to be_kind_of Contentful::Management::ApiKey }
31
31
  end
32
32
  it 'returns a Contentful::Management::ApiKey' do
33
- vcr('api_key/find') { expect(subject.find(space_id, api_key_id)).to be_kind_of Contentful::Management::ApiKey }
33
+ vcr('api_key/find') { expect(subject.find(api_key_id)).to be_kind_of Contentful::Management::ApiKey }
34
34
  end
35
35
  it 'returns the api_key for a given key' do
36
36
  vcr('api_key/find') do
37
- api_key = subject.find(space_id, api_key_id)
37
+ api_key = subject.find(api_key_id)
38
38
  expect(api_key.id).to eql api_key_id
39
39
  expect(api_key.access_token).to eql '833ea085204398499ea424c8ad832f1ae1cac4d64e2cc56db774aff87ef20b33'
40
40
  end
41
41
  end
42
42
  it 'returns an error when api_key does not exists' do
43
43
  vcr('api_key/find_for_space_not_found') do
44
- result = subject.find(space_id, 'not_exist')
44
+ result = subject.find('not_exist')
45
45
  expect(result).to be_kind_of Contentful::Management::NotFound
46
46
  end
47
47
  end
@@ -50,7 +50,7 @@ module Contentful
50
50
  describe '.create' do
51
51
  it 'create api_keys for space' do
52
52
  vcr('api_key/create_for_space') do
53
- api_key = subject.create(space_id, name: 'testLocalCreate', description: 'bg')
53
+ api_key = subject.create(name: 'testLocalCreate', description: 'bg')
54
54
  expect(api_key.name).to eql 'testLocalCreate'
55
55
  end
56
56
  end
@@ -13,21 +13,21 @@ module Contentful
13
13
 
14
14
  let!(:client) { Client.new(token) }
15
15
 
16
- subject { client.assets }
16
+ subject { client.assets(space_id, 'master') }
17
17
 
18
18
  describe '.all' do
19
19
  it 'class method also works' do
20
- vcr('asset/all') { expect(Contentful::Management::Asset.all(client, space_id)).to be_kind_of Contentful::Management::Array }
20
+ vcr('asset/all') { expect(Contentful::Management::Asset.all(client, space_id, 'master')).to be_kind_of Contentful::Management::Array }
21
21
  end
22
22
  it 'returns a Contentful::Array' do
23
- vcr('asset/all') { expect(subject.all(space_id)).to be_kind_of Contentful::Management::Array }
23
+ vcr('asset/all') { expect(subject.all).to be_kind_of Contentful::Management::Array }
24
24
  end
25
25
  it 'builds a Contentful::Management::Asset object' do
26
- vcr('asset/all') { expect(subject.all(space_id).first).to be_kind_of Contentful::Management::Asset }
26
+ vcr('asset/all') { expect(subject.all.first).to be_kind_of Contentful::Management::Asset }
27
27
  end
28
28
  it 'return limited number of assets with next_page' do
29
29
  vcr('asset/limited_assets_next_page') do
30
- assets = subject.all('bfsvtul0c41g', limit: 20, skip: 2)
30
+ assets = described_class.all(client, 'bfsvtul0c41g', 'master', limit: 20, skip: 2)
31
31
  expect(assets).to be_kind_of Contentful::Management::Array
32
32
  expect(assets.limit).to eq 20
33
33
  expect(assets.skip).to eq 2
@@ -36,45 +36,28 @@ module Contentful
36
36
  end
37
37
  it 'supports select operator' do
38
38
  vcr('asset/select_operator') do
39
- nyancat = subject.all('cfexampleapi', 'sys.id' => 'nyancat', select: 'fields.title').first
39
+ nyancat = described_class.all(client, 'cfexampleapi', 'master', 'sys.id' => 'nyancat', select: 'fields.title').first
40
40
  expect(nyancat.fields).to eq({ title: 'Nyan Cat' })
41
41
  end
42
42
  end
43
43
  end
44
44
 
45
- describe '.all_published' do
46
- let!(:space_id) { 'bjwq7b86vgmm' }
47
- before :each do
48
- expect_any_instance_of(Contentful::Management::Asset.client_association_class).to receive(:warn)
49
- end
50
-
51
- it 'class method also works' do
52
- vcr('asset/all_public') { expect(Contentful::Management::Asset.all_published(client, space_id)).to be_kind_of Contentful::Management::Array }
53
- end
54
- it 'returns a Contentful::Array' do
55
- vcr('asset/all_public') { expect(subject.all_published(space_id)).to be_kind_of Contentful::Management::Array }
56
- end
57
- it 'builds a Contentful::Management::Asset object' do
58
- vcr('asset/all_public') { expect(subject.all_published(space_id).first).to be_kind_of Contentful::Management::Asset }
59
- end
60
- end
61
-
62
45
  describe '.find' do
63
46
  it 'class method also works' do
64
- vcr('asset/find') { expect(Contentful::Management::Asset.find(client, space_id, asset_id)).to be_kind_of Contentful::Management::Asset }
47
+ vcr('asset/find') { expect(Contentful::Management::Asset.find(client, space_id, 'master', asset_id)).to be_kind_of Contentful::Management::Asset }
65
48
  end
66
49
  it 'returns a Contentful::Management::Asset' do
67
- vcr('asset/find') { expect(subject.find(space_id, asset_id)).to be_kind_of Contentful::Management::Asset }
50
+ vcr('asset/find') { expect(subject.find(asset_id)).to be_kind_of Contentful::Management::Asset }
68
51
  end
69
52
  it 'returns the asset for a given key' do
70
53
  vcr('asset/find') do
71
- asset = subject.find(space_id, asset_id)
54
+ asset = subject.find(asset_id)
72
55
  expect(asset.id).to eql asset_id
73
56
  end
74
57
  end
75
58
  it 'returns an error when content_type does not exists' do
76
59
  vcr('asset/find_not_found') do
77
- result = subject.find(space_id, 'not_exist')
60
+ result = subject.find('not_exist')
78
61
  expect(result).to be_kind_of Contentful::Management::NotFound
79
62
  message = [
80
63
  "HTTP status code: 404 Not Found",
@@ -89,7 +72,7 @@ module Contentful
89
72
  describe '#destroy' do
90
73
  it 'returns Contentful::BadRequest error when content type is published' do
91
74
  vcr('asset/destroy_published') do
92
- result = subject.find(space_id, 'r7o2iuDeSc4UmioOuoKq6').destroy
75
+ result = subject.find('r7o2iuDeSc4UmioOuoKq6').destroy
93
76
  expect(result).to be_kind_of Contentful::Management::BadRequest
94
77
  message = [
95
78
  "HTTP status code: 400 Bad Request",
@@ -100,7 +83,7 @@ module Contentful
100
83
  end
101
84
  it 'returns true when asset is not published' do
102
85
  vcr('asset/destroy') do
103
- result = subject.find(space_id, 'r7o2iuDeSc4UmioOuoKq6').destroy
86
+ result = subject.find('r7o2iuDeSc4UmioOuoKq6').destroy
104
87
  expect(result).to eq true
105
88
  end
106
89
  end
@@ -109,7 +92,7 @@ module Contentful
109
92
  describe '#unpublish' do
110
93
  it 'unpublish' do
111
94
  vcr('asset/unpublish') do
112
- asset = subject.find(space_id, asset_id_2)
95
+ asset = subject.find(asset_id_2)
113
96
  initial_version = asset.sys[:version]
114
97
  asset.unpublish
115
98
  expect(asset).to be_kind_of Contentful::Management::Asset
@@ -119,7 +102,7 @@ module Contentful
119
102
 
120
103
  it 'returns BadRequest error when already unpublished' do
121
104
  vcr('asset/unpublish_already_unpublished') do
122
- result = subject.find(space_id, asset_id_2).unpublish
105
+ result = subject.find(asset_id_2).unpublish
123
106
  expect(result).to be_kind_of Contentful::Management::BadRequest
124
107
  message = [
125
108
  "HTTP status code: 400 Bad Request",
@@ -139,7 +122,6 @@ module Contentful
139
122
  file.properties[:upload] = 'https://upload.wikimedia.org/wikipedia/commons/c/c7/Gasometer_Berlin_Sch%C3%B6neberg_2011.jpg'
140
123
 
141
124
  asset = subject.create(
142
- space_id,
143
125
  title: 'titlebyCreateAPI',
144
126
  description: 'descByAPI',
145
127
  file: file
@@ -152,7 +134,7 @@ module Contentful
152
134
 
153
135
  it 'returns Contentful::Management::Asset' do
154
136
  vcr('asset/publish') do
155
- asset = subject.find(space_id, asset_id_2)
137
+ asset = subject.find(asset_id_2)
156
138
  initial_version = asset.sys[:version]
157
139
  asset.publish
158
140
  expect(asset).to be_kind_of Contentful::Management::Asset
@@ -161,7 +143,7 @@ module Contentful
161
143
  end
162
144
  it 'returns BadRequest error when already published' do
163
145
  vcr('asset/publish_already_published') do
164
- asset = subject.find(space_id, asset_id_2)
146
+ asset = subject.find(asset_id_2)
165
147
  asset.sys[:version] = -1
166
148
  result = asset.publish
167
149
  expect(result).to be_kind_of Contentful::Management::Conflict
@@ -172,14 +154,14 @@ module Contentful
172
154
  describe '#published?' do
173
155
  it 'returns true if asset is published' do
174
156
  vcr('asset/published_true') do
175
- asset = subject.find(space_id, asset_id)
157
+ asset = subject.find(asset_id)
176
158
  asset.publish
177
159
  expect(asset.published?).to be_truthy
178
160
  end
179
161
  end
180
162
  it 'returns false if asset is not published' do
181
163
  vcr('asset/published_false') do
182
- asset = subject.find(space_id, asset_id)
164
+ asset = subject.find(asset_id)
183
165
  asset.unpublish
184
166
  expect(asset.published?).to be_falsey
185
167
  end
@@ -189,7 +171,7 @@ module Contentful
189
171
  describe '#unarchive' do
190
172
  it 'unarchive the asset' do
191
173
  vcr('asset/unarchive') do
192
- asset = subject.find(space_id, asset_id_2)
174
+ asset = subject.find(asset_id_2)
193
175
  initial_version = asset.sys[:version]
194
176
  asset.unarchive
195
177
  expect(asset).to be_kind_of Contentful::Management::Asset
@@ -199,7 +181,7 @@ module Contentful
199
181
 
200
182
  it 'returns BadRequest error when already unpublished' do
201
183
  vcr('asset/unarchive_already_unarchived') do
202
- result = subject.find(space_id, asset_id_2).unarchive
184
+ result = subject.find(asset_id_2).unarchive
203
185
  expect(result).to be_kind_of Contentful::Management::BadRequest
204
186
  end
205
187
  end
@@ -208,14 +190,14 @@ module Contentful
208
190
  describe '#archive' do
209
191
  it 'returns error when archive published asset' do
210
192
  vcr('asset/archive_published') do
211
- asset = subject.find(space_id, asset_id_2).archive
193
+ asset = subject.find(asset_id_2).archive
212
194
  expect(asset).to be_kind_of Contentful::Management::BadRequest
213
195
  end
214
196
  end
215
197
 
216
198
  it ' archive unpublished asset' do
217
199
  vcr('asset/archive') do
218
- asset = subject.find(space_id, asset_id_2)
200
+ asset = subject.find(asset_id_2)
219
201
  initial_version = asset.sys[:version]
220
202
  asset.archive
221
203
  expect(asset).to be_kind_of Contentful::Management::Asset
@@ -225,7 +207,7 @@ module Contentful
225
207
 
226
208
  it 'returns BadRequest error when already unpublished' do
227
209
  vcr('asset/unarchive_already_unarchive') do
228
- result = subject.find(space_id, asset_id_2).unarchive
210
+ result = subject.find(asset_id_2).unarchive
229
211
  expect(result).to be_kind_of Contentful::Management::BadRequest
230
212
  end
231
213
  end
@@ -234,14 +216,14 @@ module Contentful
234
216
  describe '#archived?' do
235
217
  it 'returns true if asset is archive' do
236
218
  vcr('asset/archived_true') do
237
- asset = subject.find(space_id, asset_id_2)
219
+ asset = subject.find(asset_id_2)
238
220
  asset.archive
239
221
  expect(asset.archived?).to be_truthy
240
222
  end
241
223
  end
242
224
  it 'returns false if asset is not archive' do
243
225
  vcr('asset/archived_false') do
244
- asset = subject.find(space_id, asset_id_2)
226
+ asset = subject.find(asset_id_2)
245
227
  asset.unarchive
246
228
  expect(asset.archived?).to be_falsey
247
229
  end
@@ -251,7 +233,7 @@ module Contentful
251
233
  describe '#locale' do
252
234
  it 'returns default locale' do
253
235
  vcr('asset/locale') do
254
- asset = subject.find(space_id, asset_id_2)
236
+ asset = subject.find(asset_id_2)
255
237
  expect(asset.locale).to eq asset.default_locale
256
238
  expect(asset.title).to eq 'titlebyCreateAPI'
257
239
  expect(asset.description).to eq 'descByAPI'
@@ -260,7 +242,7 @@ module Contentful
260
242
 
261
243
  it 'set locale to given asset' do
262
244
  vcr('asset/set_locale') do
263
- asset = subject.find(space_id, asset_id_2)
245
+ asset = subject.find(asset_id_2)
264
246
  asset.locale = 'pl-Pl'
265
247
  expect(asset.sys[:locale]).to eq 'pl-Pl'
266
248
  end
@@ -276,7 +258,6 @@ module Contentful
276
258
  file.properties[:upload] = 'https://upload.wikimedia.org/wikipedia/commons/c/c7/Gasometer_Berlin_Sch%C3%B6neberg_2011.jpg'
277
259
 
278
260
  asset = subject.create(
279
- space_id,
280
261
  title: 'titlebyCreateAPI',
281
262
  description: 'descByAPI',
282
263
  file: file
@@ -294,8 +275,10 @@ module Contentful
294
275
  file.properties[:fileName] = 'pic1.jpg'
295
276
  file.properties[:upload] = 'https://upload.wikimedia.org/wikipedia/commons/c/c7/Gasometer_Berlin_Sch%C3%B6neberg_2011.jpg'
296
277
 
297
- asset = subject.create(
278
+ asset = described_class.create(
279
+ client,
298
280
  'bfsvtul0c41g',
281
+ 'master',
299
282
  title: 'Title PL',
300
283
  description: 'Description PL',
301
284
  file: file,
@@ -315,7 +298,6 @@ module Contentful
315
298
  file.properties[:upload] = 'http://static.goldenline.pl/firm_logo/082/firm_225106_22f37f_small.jpg'
316
299
 
317
300
  asset = subject.create(
318
- space_id,
319
301
  id: 'codequest_id_test_custom',
320
302
  title: 'titlebyCreateAPI_custom_id',
321
303
  description: 'descByAPI_custom_id',
@@ -336,7 +318,6 @@ module Contentful
336
318
  file.properties[:upload] = 'http://static.goldenline.pl/firm_logo/082/firm_225106_22f37f_small.jpg'
337
319
 
338
320
  asset = subject.create(
339
- space_id,
340
321
  id: 'codequest_id_test_custom_id',
341
322
  title: 'titlebyCreateAPI_custom_id',
342
323
  description: 'descByAPI_custom_id',
@@ -350,7 +331,7 @@ module Contentful
350
331
  describe '#update' do
351
332
  it 'updates asset with default locale without file' do
352
333
  vcr('asset/update_with_default_locale_without_file') do
353
- asset = subject.find(space_id, '4DmT2j54pWY8ocimkEU6qS')
334
+ asset = subject.find('4DmT2j54pWY8ocimkEU6qS')
354
335
  asset.update(title: 'Title new', description: 'Description new')
355
336
  expect(asset).to be_kind_of Contentful::Management::Asset
356
337
  expect(asset.title).to eq 'Title new'
@@ -366,7 +347,7 @@ module Contentful
366
347
  file.properties[:fileName] = 'codequest.jpg'
367
348
  file.properties[:upload] = 'http://static.goldenline.pl/firm_logo/082/firm_225106_22f37f_small.jpg'
368
349
 
369
- asset = subject.find(space_id, '4DmT2j54pWY8ocimkEU6qS')
350
+ asset = subject.find('4DmT2j54pWY8ocimkEU6qS')
370
351
  asset.update(file: file)
371
352
  expect(asset).to be_kind_of Contentful::Management::Asset
372
353
  expect(asset.file.properties[:fileName]).to eq 'codequest.jpg'
@@ -380,7 +361,7 @@ module Contentful
380
361
  file.properties[:fileName] = 'codequest.jpg'
381
362
  file.properties[:upload] = 'http://static.goldenline.pl/firm_logo/082/firm_225106_22f37f_small.jpg'
382
363
 
383
- asset = subject.find(space_id, 'codequest_id_test_custom_id')
364
+ asset = subject.find('codequest_id_test_custom_id')
384
365
  asset.locale = 'pl'
385
366
  asset.update(title: 'updateTitlePl', description: 'updateDescPl', file: file)
386
367
  expect(asset).to be_kind_of Contentful::Management::Asset
@@ -393,7 +374,7 @@ module Contentful
393
374
  describe '#save' do
394
375
  it 'updated' do
395
376
  vcr('asset/save_update') do
396
- asset = subject.find(space_id, '35Kt2tInIsoauo8sC82q04')
377
+ asset = subject.find('35Kt2tInIsoauo8sC82q04')
397
378
  asset.fields[:description] = 'Firmowe logo.'
398
379
  asset.save
399
380
  expect(asset).to be_kind_of Contentful::Management::Asset
@@ -406,7 +387,7 @@ module Contentful
406
387
  let(:space_id) { 'bfsvtul0c41g' }
407
388
  it 'update the current version of the object to the version on the system' do
408
389
  vcr('asset/reload') do
409
- asset = subject.find(space_id, '8R4vbQXKbCkcSu26Wy2U0')
390
+ asset = subject.find('8R4vbQXKbCkcSu26Wy2U0')
410
391
  asset.sys[:version] = 999
411
392
  update_asset = asset.update(title: 'Updated name')
412
393
  expect(update_asset).to be_kind_of Contentful::Management::Conflict
@@ -420,7 +401,7 @@ module Contentful
420
401
 
421
402
  it 'updates fields collection when reloaded' do
422
403
  vcr('asset/reload_with_fields') do
423
- asset = subject.find(space_id, '8R4vbQXKbCkcSu26Wy2U0')
404
+ asset = subject.find('8R4vbQXKbCkcSu26Wy2U0')
424
405
  valid_fields = asset.instance_variable_get(:@fields)
425
406
  asset.instance_variable_set(:@fields, 'changed')
426
407
  asset.reload
@@ -454,7 +435,7 @@ module Contentful
454
435
  file.properties[:fileName] = 'pic1.jpg'
455
436
  file.properties[:upload] = 'https://upload.wikimedia.org/wikipedia/commons/c/c7/Gasometer_Berlin_Sch%C3%B6neberg_2011.jpg'
456
437
 
457
- asset = subject.create(space_id, title: 'Asset title', description: 'Description', file: file)
438
+ asset = subject.create(title: 'Asset title', description: 'Description', file: file)
458
439
  asset.process_file
459
440
  expect(asset).to be_kind_of Contentful::Management::Asset
460
441
  expect(asset.title).to eq 'Asset title'
@@ -479,7 +460,7 @@ module Contentful
479
460
  describe "Pagination on assets doesn't work without first calling limit - #143" do
480
461
  it 'shouldnt break on next page without parameters on original query' do
481
462
  vcr('asset/143_assets_next_page') do
482
- assets = subject.all('facgnwwgj5fe')
463
+ assets = described_class.all(client, 'facgnwwgj5fe', 'master')
483
464
  assets.next_page
484
465
  end
485
466
  end