towsta 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/towsta/version.rb +1 -1
- data/lib/towsta/vertical.rb +18 -2
- metadata +10 -7
data/lib/towsta/version.rb
CHANGED
data/lib/towsta/vertical.rb
CHANGED
@@ -145,6 +145,7 @@ module Towsta
|
|
145
145
|
return "@#{attr} = Vertical.to_bresson(value);" if kind == 'image'
|
146
146
|
return "@#{attr} = User.find value.to_i;" if kind == 'user'
|
147
147
|
return "@#{attr} = value.split(', ');" if kind == 'list'
|
148
|
+
return "@#{attr} = Vertical.to_gallery(value.to_s);" if kind == 'gallery'
|
148
149
|
"@#{attr} = value;"
|
149
150
|
end
|
150
151
|
|
@@ -152,12 +153,27 @@ module Towsta
|
|
152
153
|
return "self.all.each {|e| return e if e.#{attr} == value};" unless kind == 'list'
|
153
154
|
"self.all.each {|e| return e if e.#{attr}.include?(value)};"
|
154
155
|
end
|
155
|
-
|
156
|
+
|
156
157
|
def self.parse_find_all attr, kind
|
157
158
|
return "found =[]; self.all.each {|e| found << e if e.#{attr} == value}; found;" unless kind == 'list'
|
158
159
|
"found =[]; self.all.each {|e| found << e if e.#{attr}.include?(value)}; found;"
|
159
160
|
end
|
160
161
|
|
162
|
+
def self.to_gallery value
|
163
|
+
if value.class == String
|
164
|
+
begin;
|
165
|
+
gal = JSON.parse(value, :symbolize_names => true)
|
166
|
+
arr = []
|
167
|
+
gal.each do |g|
|
168
|
+
arr << Bresson::ImageReference.new(g)
|
169
|
+
end
|
170
|
+
return arr
|
171
|
+
rescue; nil; end
|
172
|
+
else
|
173
|
+
value
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
161
177
|
def self.to_dt value
|
162
178
|
if value.class == String
|
163
179
|
begin; DateTime.strptime(value, '%m/%d/%Y %H:%M').to_time;
|
@@ -166,7 +182,7 @@ module Towsta
|
|
166
182
|
value
|
167
183
|
end
|
168
184
|
end
|
169
|
-
|
185
|
+
|
170
186
|
def self.to_d value
|
171
187
|
if value.class == String
|
172
188
|
begin; DateTime.strptime(value, '%m/%d/%Y');
|
metadata
CHANGED
@@ -1,12 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: towsta
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 13
|
5
|
+
prerelease:
|
5
6
|
segments:
|
6
7
|
- 0
|
7
8
|
- 4
|
8
|
-
-
|
9
|
-
version: 0.4.
|
9
|
+
- 1
|
10
|
+
version: 0.4.1
|
10
11
|
platform: ruby
|
11
12
|
authors:
|
12
13
|
- Mortaro
|
@@ -14,8 +15,7 @@ autorequire:
|
|
14
15
|
bindir: bin
|
15
16
|
cert_chain: []
|
16
17
|
|
17
|
-
date: 2011-
|
18
|
-
default_executable:
|
18
|
+
date: 2011-10-20 00:00:00 Z
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
21
21
|
name: json
|
@@ -25,6 +25,7 @@ dependencies:
|
|
25
25
|
requirements:
|
26
26
|
- - ">="
|
27
27
|
- !ruby/object:Gem::Version
|
28
|
+
hash: 3
|
28
29
|
segments:
|
29
30
|
- 0
|
30
31
|
version: "0"
|
@@ -38,6 +39,7 @@ dependencies:
|
|
38
39
|
requirements:
|
39
40
|
- - ">="
|
40
41
|
- !ruby/object:Gem::Version
|
42
|
+
hash: 3
|
41
43
|
segments:
|
42
44
|
- 0
|
43
45
|
version: "0"
|
@@ -62,7 +64,6 @@ files:
|
|
62
64
|
- lib/towsta/version.rb
|
63
65
|
- lib/towsta/vertical.rb
|
64
66
|
- towsta.gemspec
|
65
|
-
has_rdoc: true
|
66
67
|
homepage: http://rubygems.org/gems/towsta
|
67
68
|
licenses: []
|
68
69
|
|
@@ -76,6 +77,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
76
77
|
requirements:
|
77
78
|
- - ">="
|
78
79
|
- !ruby/object:Gem::Version
|
80
|
+
hash: 3
|
79
81
|
segments:
|
80
82
|
- 0
|
81
83
|
version: "0"
|
@@ -84,13 +86,14 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
84
86
|
requirements:
|
85
87
|
- - ">="
|
86
88
|
- !ruby/object:Gem::Version
|
89
|
+
hash: 3
|
87
90
|
segments:
|
88
91
|
- 0
|
89
92
|
version: "0"
|
90
93
|
requirements: []
|
91
94
|
|
92
95
|
rubyforge_project: towsta
|
93
|
-
rubygems_version: 1.
|
96
|
+
rubygems_version: 1.7.2
|
94
97
|
signing_key:
|
95
98
|
specification_version: 3
|
96
99
|
summary: Api Integration gem with towsta
|