jira-ruby-dmg 0.1.24 → 0.1.25

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9cfd7cc9fd6b38350265665f0a0f471e786f70ef
4
- data.tar.gz: 32a3e8b2d1f5c5cf291590ab1c352c716bd778d5
3
+ metadata.gz: a52f74480f9d125ff8324c948295cca2104b7299
4
+ data.tar.gz: a5a79b7ee66c141e2f98c82e9cc542dfef215a02
5
5
  SHA512:
6
- metadata.gz: 6d822692482eb9729ce9a0333f7978909a6db45b904841175f632243eeb0f67ae46ac522e510f25bd97900e237a8a8931bfecb50db64c5c65f39d247af9486e9
7
- data.tar.gz: 727b7d89e273d4146c842a17b3ed694b4ef10206435b3ccd23d889b3249cf51d79c5db5ec450b3fcda8d6a62fdcf089ece85f0ce0212539d79ef972ca9008aec
6
+ metadata.gz: 022ff0631158b910d019346c2c41d2692d719c744226644e0ce4d5a8d0295cd0cf4767c06147630c5e0b1b3092d63a56ea11d85cf0f40a908eb7647349c0c9c9
7
+ data.tar.gz: 83f626e7dfc93b680c34b99dac9a3af4c65459833ea4cefdaf3bae542a984af25d84898c6b5f891d7bda43dc08caaa8b3f590c4ef7d37e823aaf08ce72ea9770
data/.gitignore CHANGED
@@ -8,4 +8,5 @@ pkg/*
8
8
  *.pem
9
9
  .DS_STORE
10
10
  doc
11
- lib/debugClient.rb
11
+ lib/debugClient.rb
12
+ cache
data/lib/jira/client.rb CHANGED
@@ -161,7 +161,7 @@ module JIRA
161
161
  response = request(:get, path, nil, merge_default_headers(headers))
162
162
  @cache.save(path, Marshal.dump(response))
163
163
  else
164
- repsonse = Marshal.restore(cached_response)
164
+ response = Marshal.restore(cached_response)
165
165
  end
166
166
 
167
167
  response
@@ -6,30 +6,30 @@ module JIRA
6
6
  @time_to_live = time_to_live
7
7
  end
8
8
 
9
- def load(path)
10
- key = cache_key(path)
11
- cache_object = cache(path)
9
+ def load(uri)
10
+ key = cache_key(uri)
11
+ cache_object = cache(uri)
12
12
  response = verify cache_object[key]
13
13
 
14
14
  if response == :expired
15
15
  cache_object.delete(key)
16
- cache_file(path, 'w+').write(Marshal.dump(cache_object))
16
+ cache_file(uri, 'w+').write(Marshal.dump(cache_object))
17
17
  nil
18
18
  else
19
19
  response
20
20
  end
21
21
  end
22
22
 
23
- def save(path, response)
23
+ def save(uri, response)
24
24
  now = Time.now.to_i
25
25
 
26
- new_cache = cache(path)
27
- new_cache[cache_key(path)] = {
26
+ new_cache = cache(uri)
27
+ new_cache[cache_key(uri)] = {
28
28
  'data' => response,
29
29
  'timestamp' => now
30
30
  }
31
31
 
32
- cache_file(path, 'w+').write(Marshal.dump(new_cache))
32
+ cache_file(uri, 'w+').write(Marshal.dump(new_cache))
33
33
  end
34
34
 
35
35
 
@@ -47,34 +47,32 @@ module JIRA
47
47
  end
48
48
  end
49
49
 
50
- def cache(path)
51
- #binding.pry
52
- path.gsub!('/', '_')
53
- if File.exists? 'cache/' + path
54
- Marshal.restore(cache_file(path, 'r+').read())
50
+ def cache(uri)
51
+ if File.exists? cache_path(uri)
52
+ Marshal.restore(cache_file(uri, 'r+').read())
55
53
  else
56
54
  {}
57
55
  end
58
56
  end
59
57
 
60
- def cache_key(path)
58
+ def cache_key(uri)
61
59
  return "key"
62
- #Marshal.dump(path)
60
+ #Marshal.dump(uri)
63
61
  end
64
62
 
65
- def cache_file(path, mode)
66
- dir = cache_dir
67
- File.new(dir + '/' + path, mode)
63
+ def cache_file(uri, mode)
64
+ path = cache_path(uri)
65
+ File.new(path, mode)
68
66
  end
69
67
 
70
- def cache_dir
68
+ def cache_path(uri)
71
69
  dir = 'cache'
72
70
 
73
71
  unless Dir.exists? dir
74
72
  FileUtils.mkdir_p(dir)
75
73
  end
76
74
 
77
- dir
75
+ dir + '/' + uri.gsub('/', '_')
78
76
  end
79
77
  end
80
78
 
data/lib/jira/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module JIRA
2
- VERSION = "0.1.24"
2
+ VERSION = "0.1.25"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jira-ruby-dmg
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.24
4
+ version: 0.1.25
5
5
  platform: ruby
6
6
  authors:
7
7
  - ThisIs! DMG