towsta 3.0.3 → 3.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/towsta.rb +2 -2
- data/lib/towsta/synchronizer.rb +10 -0
- data/lib/towsta/version.rb +1 -1
- metadata +8 -8
data/lib/towsta.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
1
|
#coding: utf-8
|
2
|
-
files = %w(cgi net/http json bresson cameraman active_support/all)
|
2
|
+
files = %w(cgi net/http json bresson cameraman active_support/all digest/md5)
|
3
3
|
files.each {|file| require file}
|
4
4
|
|
5
5
|
module Towsta
|
6
|
-
mattr_accessor :secret, :global, :author, :models_path, :env
|
6
|
+
mattr_accessor :secret, :global, :author, :models_path, :env, :cache
|
7
7
|
end
|
8
8
|
|
9
9
|
files = %w(base attributes crud mail references)
|
data/lib/towsta/synchronizer.rb
CHANGED
@@ -38,7 +38,16 @@ module Towsta
|
|
38
38
|
|
39
39
|
private
|
40
40
|
|
41
|
+
def sync_code
|
42
|
+
Digest::MD5.hexdigest @params.to_s
|
43
|
+
end
|
44
|
+
|
41
45
|
def synchronize
|
46
|
+
if Rails.cache.read(sync_code)
|
47
|
+
@hash = Rails.cache.read(sync_code)
|
48
|
+
puts "--> Using cache to Towst"
|
49
|
+
return true
|
50
|
+
end
|
42
51
|
has_secret && (cache_string || remote_string) && validate_secret && validate_response && parse_json
|
43
52
|
end
|
44
53
|
|
@@ -96,6 +105,7 @@ module Towsta
|
|
96
105
|
def parse_json
|
97
106
|
begin
|
98
107
|
@hash = JSON.parse @response, symbolize_names: true
|
108
|
+
Rails.cache.write(sync_code, @hash)
|
99
109
|
return true
|
100
110
|
rescue
|
101
111
|
puts ' Something went wrong tryng to parse JSON.'
|
data/lib/towsta/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: towsta
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.0.
|
4
|
+
version: 3.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-01-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bresson
|
16
|
-
requirement: &
|
16
|
+
requirement: &26326740 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *26326740
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: cameraman
|
27
|
-
requirement: &
|
27
|
+
requirement: &26326452 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *26326452
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rspec
|
38
|
-
requirement: &
|
38
|
+
requirement: &26326188 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,7 +43,7 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :development
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *26326188
|
47
47
|
description: Simply integrates the Towsta api
|
48
48
|
email:
|
49
49
|
- mortaro@towsta.com
|