lib/travis/client/session.rb in travis-1.5.9.travis.360.4 vs lib/travis/client/session.rb in travis-1.5.9.travis.361.4

- old
+ new

@@ -148,10 +148,14 @@ def get(*args) load get_raw(*args) end + def delete(*args) + load delete_raw(*args) + end + def get_raw(*args) raw(:get, *args) end def post_raw(*args) @@ -160,10 +164,15 @@ def put_raw(*args) raw(:put, *args) end + def delete_raw(*args) + raw(:delete, *args) + end + + def raw(verb, url, *args) url = url.sub(/^\//, '') result = instrumented(verb.to_s.upcase, url, *args) { connection.public_send(verb, url, *args) } raise Travis::Client::Error, 'SSL error: could not verify peer' if result.status == 0 result.body @@ -223,11 +232,11 @@ result end def create_entity(type, data) data = { type.id_field => data } if type.id? data - id = type.cast_id(data.fetch(type.id_field)) - entity = cached(type, :id, id) { type.new(self, id) } + id = type.cast_id(data.fetch(type.id_field)) unless type.weak? + entity = id ? cached(type, :id, id) { type.new(self, id) } : type.new(self, nil) entity.update_attributes(data) entity end def handle_error(e)