Method: Rpdoc::PostmanCollection#push_and_update

Defined in:
lib/rpdoc/postman_collection.rb

#push_and_updateObject



23
24
25
26
27
28
29
30
31
32
33
# File 'lib/rpdoc/postman_collection.rb', line 23

def push_and_update
  path = "#{@configuration.postman_collection_path}/#{@configuration.collection_uid}"
  headers = {
    'X-Api-Key': @configuration.postman_apikey
  }
  remote_collection_data = @requester.http_send(:get, path, {}, headers)
  remote_collection_data = remote_collection_data['status'] == 200 ? remote_collection_data.deep_symbolize_keys.slice(:collection) : nil
  
  merged_by(remote_collection_data)
  @requester.http_send(:put, path, remote_collection_data, headers)
end