haraway 0.1.0.dev.46 → 0.1.0.dev.47

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2cc9e079d245eac803a6f5ad0767cbc9f1fff7f8
4
- data.tar.gz: d686d738f27090974f51e11ce4ed39e353a25fb9
3
+ metadata.gz: a5c551d80699f6209c2e7ec9e66e02c04eccb5a0
4
+ data.tar.gz: 3c756a320f549230206f99f9d791416f43b97286
5
5
  SHA512:
6
- metadata.gz: 11a11a38c7b36f90467f531442c36d97ad957995b6175825ca84f742e8e23dc4731e86f942614672d99c7bb96f21e99800d89fac16ffe20f99a49c9aadb4188e
7
- data.tar.gz: 2ed68a6c0b604311be44c62340f244bb260feb1e2ca897c30aec1c21ab40d726f8dc7a61cdaef4d05e1ec6ae7eb4d553b65744744b72b0880f265e52fe435d45
6
+ metadata.gz: 4be6b6917602ab8d490e9615e7092249b38a95cbf9dbf2a1915cc363deed57d460c1f8f6eedf7434200a76f9b2bda94d1440f39b211c8506074d043608585114
7
+ data.tar.gz: a29cf0aee875795c7403fe32a79b5e87589de6ab50d0eff9043360d0ac66a9198a6b666261b27bbde2ae7094e71a867a6a7b9f35b1d1040e626d2404c00b900d
@@ -13,6 +13,10 @@ class Haraway::ActiveRecord::Asset
13
13
  !!@_destroy
14
14
  end
15
15
 
16
+ def destroy!
17
+ @_destroy = true
18
+ end
19
+
16
20
  def url(version=nil)
17
21
  if version.nil?
18
22
  self.url("original")
@@ -29,6 +33,13 @@ class Haraway::ActiveRecord::Asset
29
33
  @attributes = attributes.except(:id, :_destroy)
30
34
  end
31
35
 
36
+ def attributes
37
+ attributes = @attributes.dup
38
+ attributes[:id] = @id
39
+ attributes[:_destroy] = true if @_destroy
40
+ attributes.with_indifferent_access
41
+ end
42
+
32
43
  def method_missing(m, *a, &b)
33
44
  case m.to_s
34
45
 
@@ -106,7 +106,14 @@ private
106
106
  end
107
107
 
108
108
  def #{name}=(value)
109
- haraway_write_assets(#{name.inspect}, [value])
109
+ values = [value]
110
+
111
+ haraway_read_assets(#{name.inspect}).each do |old_asset|
112
+ old_asset.destroy!
113
+ values.push(old_asset.attributes)
114
+ end
115
+
116
+ haraway_write_assets(#{name.inspect}, values)
110
117
  end
111
118
 
112
119
  self
@@ -37,11 +37,8 @@ class Haraway::Config
37
37
  @config.secret_key = v
38
38
  end
39
39
 
40
- def pusher_key=(v)
41
- @config.pusher_key = v
42
- end
43
-
44
40
  def profile(name, &block)
41
+ name = name.to_s
45
42
  profile = Haraway::Profile.new(name, &block)
46
43
  @config.profiles[name] = profile
47
44
  end
@@ -13,9 +13,10 @@ class Haraway::Deleter
13
13
  token = creds.make_authentication_message("manager")
14
14
 
15
15
  Net::HTTP.start("api."+@config.endpoint, :use_ssl => @config.use_ssl) do |http|
16
- req = Net::HTTP::Post.new("/v1/#{@config.access_key}/delete?token="+token)
16
+ req = Net::HTTP::Post.new("/delete")
17
17
  req["Content-Type"] = "text/json; charset=utf-8"
18
- req.body = JSON.dump(@assets)
18
+ req["Authorization"] = "haraway-token #{token}"
19
+ req.body = JSON.dump({ :asset_ids => @assets })
19
20
 
20
21
  resp = http.request(req)
21
22
  if resp.code != "200"
@@ -1,6 +1,6 @@
1
1
  module Haraway
2
2
  VERSION = "0.1.0"
3
- BUILD = "46"
3
+ BUILD = "47"
4
4
 
5
5
  if BUILD != ("{{BUILD_NUMBER" + "}}") # prevent sed replacement (see script/ci)
6
6
  BUILD_VERSION = "#{VERSION}.dev.#{BUILD}"
@@ -26,6 +26,7 @@ class Haraway::Profile
26
26
  end
27
27
 
28
28
  def version(name, &block)
29
+ name = name.to_s
29
30
  version = Haraway::Version.new(name, &block)
30
31
  version.validate!
31
32
  @profile.versions[name] = version
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: haraway
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0.dev.46
4
+ version: 0.1.0.dev.47
5
5
  platform: ruby
6
6
  authors:
7
7
  - Simon Menke
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-04 00:00:00.000000000 Z
11
+ date: 2014-03-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler