cartodb-rb-client 0.4.0 → 0.4.1

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.
@@ -108,7 +108,7 @@ describe 'CartoDB model data methods', :vcr => true do
108
108
  record.name.should be == 'Prueba'
109
109
  record.description.should match /Lorem ipsum dolor sit amet, consectetur adipisicing elit/
110
110
  record.latitude.should be == 40.582394
111
- record.longitude.should be == -3.9941309999999817
111
+ record.longitude.should be == -3.994131
112
112
  record.length.should be == '1243m'
113
113
 
114
114
  losail_circuit.name.should be == 'Prueba'
@@ -127,4 +127,31 @@ describe 'CartoDB model data methods', :vcr => true do
127
127
 
128
128
  end
129
129
 
130
+ it "should save polygons in different formats" do
131
+ polygon_json = '{"type":"MultiPolygon","coordinates":[[[[-3.779297,32.249974],[-8.525391,26.588527],[-2.021484,20.303418],[9.228516,23.563987],[6.943359,29.688053],[5.712891,32.546813]]]]}'
132
+
133
+ polygon_model = PolygonGeometryModel.new
134
+ polygon_model.the_geom = polygon_json
135
+ polygon_model.the_geom.should eql(RGeo::GeoJSON.decode(polygon_json, :json_parser => :json, :geo_factory => RGeo::Geographic.spherical_factory(:srid => 4326)))
136
+ expect {
137
+ polygon_model.save.should be_true
138
+ }.to change{CartoDB::Connection.records('polygon_geometry_model').total_rows}.by(1)
139
+ polygon_model.the_geom.should eql(RGeo::GeoJSON.decode(polygon_json, :json_parser => :json, :geo_factory => RGeo::Geographic.spherical_factory(:srid => 4326)))
140
+
141
+ polygon_model = PolygonGeometryModel.new(:the_geom => polygon_json)
142
+ polygon_model.the_geom.should eql(RGeo::GeoJSON.decode(polygon_json, :json_parser => :json, :geo_factory => RGeo::Geographic.spherical_factory(:srid => 4326)))
143
+ expect {
144
+ polygon_model.save.should be_true
145
+ }.to change{CartoDB::Connection.records('polygon_geometry_model').total_rows}.by(1)
146
+ polygon_model.the_geom.should eql(RGeo::GeoJSON.decode(polygon_json, :json_parser => :json, :geo_factory => RGeo::Geographic.spherical_factory(:srid => 4326)))
147
+
148
+ polygon_model = PolygonGeometryModel.new(:the_geom => ::JSON.parse(polygon_json))
149
+ polygon_model.the_geom.should eql(RGeo::GeoJSON.decode(polygon_json, :json_parser => :json, :geo_factory => RGeo::Geographic.spherical_factory(:srid => 4326)))
150
+ expect {
151
+ polygon_model.save.should be_true
152
+ }.to change{CartoDB::Connection.records('polygon_geometry_model').total_rows}.by(1)
153
+ polygon_model.the_geom.should eql(RGeo::GeoJSON.decode(polygon_json, :json_parser => :json, :geo_factory => RGeo::Geographic.spherical_factory(:srid => 4326)))
154
+
155
+ end
156
+
130
157
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cartodb-rb-client
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15
4
+ hash: 13
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
- - 0
10
- version: 0.4.0
9
+ - 1
10
+ version: 0.4.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Fernando Espinosa
@@ -110,7 +110,7 @@ dependencies:
110
110
  requirement: &id006 !ruby/object:Gem::Requirement
111
111
  none: false
112
112
  requirements:
113
- - - "="
113
+ - - ">="
114
114
  - !ruby/object:Gem::Version
115
115
  hash: 23
116
116
  segments:
@@ -126,7 +126,7 @@ dependencies:
126
126
  requirement: &id007 !ruby/object:Gem::Requirement
127
127
  none: false
128
128
  requirements:
129
- - - "="
129
+ - - ">="
130
130
  - !ruby/object:Gem::Version
131
131
  hash: 21
132
132
  segments:
@@ -246,6 +246,7 @@ files:
246
246
  - spec/fixtures/cassettes/CartoDB_model_data_methods/should_initialize_attributes_of_the_model_without_persisting_them.yml
247
247
  - spec/fixtures/cassettes/CartoDB_model_data_methods/should_persist_into_cartodb_using_the_save_method.yml
248
248
  - spec/fixtures/cassettes/CartoDB_model_data_methods/should_persist_into_cartodb_using_the_static_create_method.yml
249
+ - spec/fixtures/cassettes/CartoDB_model_data_methods/should_save_polygons_in_different_formats.yml
249
250
  - spec/fixtures/cassettes/CartoDB_model_data_methods/should_update_an_existing_record.yml
250
251
  - spec/fixtures/cassettes/CartoDB_model_metadata_methods/should_add_more_columns_if_the_table_previously_exists.yml
251
252
  - spec/fixtures/cassettes/CartoDB_model_metadata_methods/should_contain_an_array_of_columns.yml
@@ -358,6 +359,7 @@ test_files:
358
359
  - spec/fixtures/cassettes/CartoDB_model_data_methods/should_initialize_attributes_of_the_model_without_persisting_them.yml
359
360
  - spec/fixtures/cassettes/CartoDB_model_data_methods/should_persist_into_cartodb_using_the_save_method.yml
360
361
  - spec/fixtures/cassettes/CartoDB_model_data_methods/should_persist_into_cartodb_using_the_static_create_method.yml
362
+ - spec/fixtures/cassettes/CartoDB_model_data_methods/should_save_polygons_in_different_formats.yml
361
363
  - spec/fixtures/cassettes/CartoDB_model_data_methods/should_update_an_existing_record.yml
362
364
  - spec/fixtures/cassettes/CartoDB_model_metadata_methods/should_add_more_columns_if_the_table_previously_exists.yml
363
365
  - spec/fixtures/cassettes/CartoDB_model_metadata_methods/should_contain_an_array_of_columns.yml