towsta 0.3.7 → 0.3.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,3 +1,3 @@
1
1
  module Towsta
2
- VERSION = "0.3.7"
2
+ VERSION = "0.3.8"
3
3
  end
@@ -1,5 +1,6 @@
1
1
  require 'date'
2
2
  require 'time'
3
+ require 'bresson'
3
4
 
4
5
  module Towsta
5
6
 
@@ -139,6 +140,7 @@ module Towsta
139
140
  return "@#{attr} = value == '1';" if kind == 'boolean'
140
141
  return "@#{attr} = Vertical.to_dt(value);" if kind == 'datetime'
141
142
  return "@#{attr} = Vertical.to_d(value);" if kind == 'date'
143
+ return "@#{attr} = Vertical.to_bresson(value);" if kind == 'image'
142
144
  return "@#{attr} = User.find value.to_i;" if kind == 'user'
143
145
  return "@#{attr} = value.split(', ');" if kind == 'list'
144
146
  "@#{attr} = value;"
@@ -157,7 +159,7 @@ module Towsta
157
159
  def self.to_dt value
158
160
  if value.class == String
159
161
  begin; DateTime.strptime(value, '%m/%d/%Y %H:%M').to_time;
160
- rescue; nil; end;
162
+ rescue; nil; end
161
163
  else
162
164
  value
163
165
  end
@@ -166,12 +168,17 @@ module Towsta
166
168
  def self.to_d value
167
169
  if value.class == String
168
170
  begin; DateTime.strptime(value, '%m/%d/%Y %H:%M');
169
- rescue; nil; end;
171
+ rescue; nil; end
170
172
  else
171
173
  value
172
174
  end
173
175
  end
174
176
 
177
+ def self.to_bresson value
178
+ begin; Bresson::ImageReference.new JSON.parse(value[1..-2], :symbolize_names => true)
179
+ rescue; nil; end
180
+ end
181
+
175
182
  end
176
183
 
177
184
  end
data/towsta.gemspec CHANGED
@@ -15,6 +15,7 @@ Gem::Specification.new do |s|
15
15
  s.rubyforge_project = "towsta"
16
16
 
17
17
  s.add_dependency("json")
18
+ s.add_dependency("bresson")
18
19
 
19
20
  s.files = `git ls-files`.split("\n")
20
21
  s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 3
8
- - 7
9
- version: 0.3.7
8
+ - 8
9
+ version: 0.3.8
10
10
  platform: ruby
11
11
  authors:
12
12
  - Mortaro
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-05-01 00:00:00 -03:00
17
+ date: 2011-05-02 00:00:00 -03:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
@@ -30,6 +30,19 @@ dependencies:
30
30
  version: "0"
31
31
  type: :runtime
32
32
  version_requirements: *id001
33
+ - !ruby/object:Gem::Dependency
34
+ name: bresson
35
+ prerelease: false
36
+ requirement: &id002 !ruby/object:Gem::Requirement
37
+ none: false
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ segments:
42
+ - 0
43
+ version: "0"
44
+ type: :runtime
45
+ version_requirements: *id002
33
46
  description: Simply integrates the towsta api
34
47
  email:
35
48
  - mortaro@towsta.com