cartodb-rb-client 0.4.2 → 0.4.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +0 -1
- data/.rvmrc +1 -2
- data/README.markdown +12 -1
- data/cartodb-rb-client.gemspec +1 -1
- data/lib/cartodb-rb-client.rb +1 -0
- data/lib/cartodb-rb-client/cartodb/client/authorization.rb +7 -1
- data/lib/cartodb-rb-client/cartodb/client/connection/base.rb +2 -2
- data/lib/cartodb-rb-client/version.rb +1 -1
- data/spec/client_spec.rb +1 -1
- data/spec/fixtures/cassettes/CartoDB_client/should_add_and_remove_colums_in_a_previously_created_table.yml +527 -268
- data/spec/fixtures/cassettes/CartoDB_client/should_allow_reserved_words_in_columns_names.yml +243 -80
- data/spec/fixtures/cassettes/CartoDB_client/should_change_a_previously_created_column.yml +309 -121
- data/spec/fixtures/cassettes/CartoDB_client/should_create_a_table_and_get_its_table_definition.yml +1611 -100
- data/spec/fixtures/cassettes/CartoDB_client/should_create_a_table_forcing_the_schema_and_get_its_table_definition.yml +258 -83
- data/spec/fixtures/cassettes/CartoDB_client/should_create_a_table_from_a_csv_file.yml +2028 -1052
- data/spec/fixtures/cassettes/CartoDB_client/should_create_a_table_with_MULTILINESTRING_type_geometry.yml +259 -83
- data/spec/fixtures/cassettes/CartoDB_client/should_create_a_table_with_MULTIPOLYGON_type_geometry.yml +258 -83
- data/spec/fixtures/cassettes/CartoDB_client/should_create_a_table_with_POINT_type_geometry.yml +542 -85
- data/spec/fixtures/cassettes/CartoDB_client/should_delete_a_table_s_row.yml +342 -153
- data/spec/fixtures/cassettes/CartoDB_client/should_drop_a_table.yml +297 -195
- data/spec/fixtures/cassettes/CartoDB_client/should_escape_properly_input_data_in_insert_queries.yml +254 -80
- data/spec/fixtures/cassettes/CartoDB_client/should_execute_a_select_query_and_return_results.yml +806 -434
- data/spec/fixtures/cassettes/CartoDB_client/should_get_a_table_by_its_name.yml +258 -83
- data/spec/fixtures/cassettes/CartoDB_client/should_import_any_kind_of_data_file.yml +752 -413
- data/spec/fixtures/cassettes/CartoDB_client/should_insert_a_row_in_a_table.yml +316 -80
- data/spec/fixtures/cassettes/CartoDB_client/should_paginate_records.yml +2942 -1924
- data/spec/fixtures/cassettes/CartoDB_client/should_rename_an_existing_table.yml +259 -83
- data/spec/fixtures/cassettes/CartoDB_client/should_return_errors_on_invalid_queries.yml +105 -32
- data/spec/fixtures/cassettes/CartoDB_client/should_return_nil_when_requesting_a_table_which_does_not_exists.yml +190 -40
- data/spec/fixtures/cassettes/CartoDB_client/should_return_user_s_table_list.yml +188 -120
- data/spec/fixtures/cassettes/CartoDB_client/should_update_a_row_in_a_table.yml +292 -115
- data/spec/fixtures/cassettes/CartoDB_model_data_methods/should_destroy_a_previously_created_record.yml +1544 -1022
- data/spec/fixtures/cassettes/CartoDB_model_data_methods/should_initialize_attributes_of_the_model_without_persisting_them.yml +900 -160
- data/spec/fixtures/cassettes/CartoDB_model_data_methods/should_persist_into_cartodb_using_the_save_method.yml +1571 -1031
- data/spec/fixtures/cassettes/CartoDB_model_data_methods/should_persist_into_cartodb_using_the_static_create_method.yml +1447 -950
- data/spec/fixtures/cassettes/CartoDB_model_data_methods/should_save_polygons_in_different_formats.yml +1485 -948
- data/spec/fixtures/cassettes/CartoDB_model_data_methods/should_update_an_existing_record.yml +2363 -1535
- data/spec/fixtures/cassettes/CartoDB_model_metadata_methods/should_add_more_columns_if_the_table_previously_exists.yml +1267 -748
- data/spec/fixtures/cassettes/CartoDB_model_metadata_methods/should_contain_an_array_of_columns.yml +1620 -1056
- data/spec/fixtures/cassettes/CartoDB_model_metadata_methods/should_create_a_table_with_custom_name_if_specified.yml +276 -189
- data/spec/fixtures/cassettes/CartoDB_model_metadata_methods/should_create_model_with_custom_data_types_columns.yml +444 -300
- data/spec/fixtures/cassettes/CartoDB_model_metadata_methods/should_create_model_with_polygon_type_geometry_columns.yml +411 -190
- data/spec/fixtures/cassettes/CartoDB_model_metadata_methods/should_create_the_table_in_cartodb_if_it_doesn_t_exists.yml +830 -562
- data/spec/fixtures/cassettes/CartoDB_model_metadata_methods/should_have_a_valid_CartoDB_Client_instance_as_a_connection_object.yml +778 -489
- data/spec/fixtures/cassettes/CartoDB_model_metadata_methods/should_have_a_valid_table_name.yml +765 -522
- data/spec/fixtures/cassettes/CartoDB_model_metadata_methods/should_return_only_data_columns.yml +880 -613
- data/spec/fixtures/cassettes/CartoDB_model_scopes/should_allow_to_select_the_specified_fiels.yml +25627 -17752
- data/spec/fixtures/cassettes/CartoDB_model_scopes/should_count_all_records.yml +22192 -15387
- data/spec/fixtures/cassettes/CartoDB_model_scopes/should_find_a_record_by_its_id.yml +21667 -15012
- data/spec/fixtures/cassettes/CartoDB_model_scopes/should_order_results.yml +23508 -16246
- data/spec/fixtures/cassettes/CartoDB_model_scopes/should_paginate_results.yml +35431 -24288
- data/spec/fixtures/cassettes/CartoDB_model_scopes/should_return_all_records_paginated.yml +23505 -16294
- data/spec/fixtures/cassettes/CartoDB_model_scopes/should_search_records_by_certain_filters.yml +5898 -3768
- data/spec/fixtures/cassettes/cartodb_spec_models.yml +2806 -1864
- data/spec/fixtures/cassettes/clean_tables.yml +170 -212
- data/spec/spec_helper.rb +45 -92
- data/spec/support/cartodb_config.yml +11 -0
- data/spec/support/cartodb_config.yml.sample +5 -4
- metadata +16 -6
@@ -2,13 +2,13 @@
|
|
2
2
|
http_interactions:
|
3
3
|
- request:
|
4
4
|
method: get
|
5
|
-
uri: https://cartodb-rb-client.cartodb.com/api/v1/tables?
|
5
|
+
uri: https://cartodb-rb-client.cartodb.com/api/v1/tables?api_key=242015a0c60666b5cdff0ce614334668817b52ac
|
6
6
|
body:
|
7
7
|
encoding: US-ASCII
|
8
8
|
string: ''
|
9
9
|
headers:
|
10
10
|
Accept:
|
11
|
-
- &
|
11
|
+
- &70175296087520 !ruby/object:MIME::Type
|
12
12
|
content_type: application/json
|
13
13
|
raw_media_type: application
|
14
14
|
raw_sub_type: json
|
@@ -18,249 +18,207 @@ http_interactions:
|
|
18
18
|
extensions:
|
19
19
|
- json
|
20
20
|
encoding: 8bit
|
21
|
-
system:
|
21
|
+
system:
|
22
22
|
registered: true
|
23
23
|
url:
|
24
24
|
- IANA
|
25
25
|
- RFC4627
|
26
|
-
obsolete:
|
27
|
-
docs:
|
28
|
-
Authorization:
|
29
|
-
- OAuth oauth_consumer_key="0gRpcgKQK8bpcvSzM5ED4NqaSbNQ8ivS4q0pVdJF", oauth_nonce="VEi9jwsh7M68W8emeqcxoZjaBtoeA4wLfNGy8qVj2s",
|
30
|
-
oauth_signature="Cz8LzmTlBslwlfEJ1bm5I7iHTgY%3D", oauth_signature_method="HMAC-SHA1",
|
31
|
-
oauth_timestamp="1337788390", oauth_token="7PalByYmKY8Dzh76fnt05e0YPXRJino0dyqHZYCw",
|
32
|
-
oauth_version="1.0"
|
26
|
+
obsolete:
|
27
|
+
docs:
|
33
28
|
response:
|
34
29
|
status:
|
35
30
|
code: 200
|
36
|
-
message:
|
31
|
+
message: !binary |-
|
32
|
+
T0s=
|
37
33
|
headers:
|
38
|
-
|
39
|
-
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
34
|
+
!binary "U2VydmVy":
|
35
|
+
- !binary |-
|
36
|
+
bmdpbng=
|
37
|
+
!binary "RGF0ZQ==":
|
38
|
+
- !binary |-
|
39
|
+
TW9uLCAyMCBBdWcgMjAxMiAxMDo1ODoyOSBHTVQ=
|
40
|
+
!binary "Q29udGVudC1UeXBl":
|
41
|
+
- !binary |-
|
42
|
+
YXBwbGljYXRpb24vanNvbjsgY2hhcnNldD11dGYtOA==
|
43
|
+
!binary "VHJhbnNmZXItRW5jb2Rpbmc=":
|
44
|
+
- !binary |-
|
45
|
+
Y2h1bmtlZA==
|
46
|
+
!binary "Q29ubmVjdGlvbg==":
|
47
|
+
- !binary |-
|
48
|
+
a2VlcC1hbGl2ZQ==
|
49
|
+
!binary "VmFyeQ==":
|
50
|
+
- !binary |-
|
51
|
+
QWNjZXB0LUVuY29kaW5n
|
52
|
+
!binary "U3RhdHVz":
|
53
|
+
- !binary |-
|
54
|
+
MjAwIE9L
|
55
|
+
!binary "RXRhZw==":
|
56
|
+
- !binary |-
|
57
|
+
IjIxZTZhOWFhMDg0NmUzYmJlZGNiYjhmMzhkYzQwZjNmIg==
|
58
|
+
!binary "Q2FjaGUtQ29udHJvbA==":
|
59
|
+
- !binary |-
|
60
|
+
bWF4LWFnZT0wLCBwcml2YXRlLCBtdXN0LXJldmFsaWRhdGU=
|
61
|
+
!binary "WC1VYS1Db21wYXRpYmxl":
|
62
|
+
- !binary |-
|
63
|
+
SUU9RWRnZSxjaHJvbWU9MQ==
|
64
|
+
!binary "U2V0LUNvb2tpZQ==":
|
65
|
+
- !binary |-
|
66
|
+
X2NhcnRvZGJfc2Vzc2lvbj1CQWg3QjBraUQzTmxjM05wYjI1ZmFXUUdPZ1pG
|
67
|
+
UmlJbE9HWmpPR1ZqWTJSaVpqUTRaRFF4WVRFeFpETmtPVFV4WVRZME9HRXpO
|
68
|
+
akJKSWlaM1lYSmtaVzR1ZFhObGNpNWpZWEowYjJSaUxYSmlMV05zYVdWdWRD
|
69
|
+
NXJaWGtHT3dCVVNTSVdZMkZ5ZEc5a1lpMXlZaTFqYkdsbGJuUUdPd0JVLS1h
|
70
|
+
OTg5ZTcxNjBhYjc1MzJkNjYwMjIzOTE3YWFhYzAwNjI2NWIyZTczOyBkb21h
|
71
|
+
aW49LmNhcnRvZGIuY29tOyBwYXRoPS87IEh0dHBPbmx5
|
72
|
+
!binary "WC1SdW50aW1l":
|
73
|
+
- !binary |-
|
74
|
+
MC4wMTExOTk=
|
75
|
+
!binary "Q29udGVudC1FbmNvZGluZw==":
|
76
|
+
- !binary |-
|
77
|
+
Z3ppcA==
|
65
78
|
body:
|
66
79
|
encoding: ASCII-8BIT
|
67
|
-
string: !
|
68
|
-
|
69
|
-
|
80
|
+
string: !binary |-
|
81
|
+
eyJ0b3RhbF9lbnRyaWVzIjoyLCJ0YWJsZXMiOlt7ImlkIjo4MjI0LCJuYW1l
|
82
|
+
IjoidGFibGVfMiIsInByaXZhY3kiOiJQVUJMSUMiLCJ0YWdzIjoiIiwic2No
|
83
|
+
ZW1hIjpbWyJjYXJ0b2RiX2lkIiwibnVtYmVyIl0sWyJ0aGVfZ2VvbSIsImdl
|
84
|
+
b21ldHJ5IiwiZ2VvbWV0cnkiLCJwb2ludCJdLFsiZGVzY3JpcHRpb24iLCJz
|
85
|
+
dHJpbmciXSxbIm5hbWUiLCJzdHJpbmciXSxbImNyZWF0ZWRfYXQiLCJkYXRl
|
86
|
+
Il0sWyJ1cGRhdGVkX2F0IiwiZGF0ZSJdXSwidXBkYXRlZF9hdCI6IjIwMTIt
|
87
|
+
MDgtMjBUMTI6NTg6MDcrMDI6MDAiLCJyb3dzX2NvdW50ZWQiOjB9LHsiaWQi
|
88
|
+
OjgyMjMsIm5hbWUiOiJ0YWJsZV8xIiwicHJpdmFjeSI6IlBVQkxJQyIsInRh
|
89
|
+
Z3MiOiIiLCJzY2hlbWEiOltbImNhcnRvZGJfaWQiLCJudW1iZXIiXSxbInRo
|
90
|
+
ZV9nZW9tIiwiZ2VvbWV0cnkiLCJnZW9tZXRyeSIsInBvaW50Il0sWyJkZXNj
|
91
|
+
cmlwdGlvbiIsInN0cmluZyJdLFsibmFtZSIsInN0cmluZyJdLFsiY3JlYXRl
|
92
|
+
ZF9hdCIsImRhdGUiXSxbInVwZGF0ZWRfYXQiLCJkYXRlIl1dLCJ1cGRhdGVk
|
93
|
+
X2F0IjoiMjAxMi0wOC0yMFQxMjo1ODowNiswMjowMCIsInJvd3NfY291bnRl
|
94
|
+
ZCI6MH1dfQ==
|
95
|
+
http_version: !binary |-
|
96
|
+
MS4x
|
97
|
+
recorded_at: Mon, 20 Aug 2012 10:58:29 GMT
|
70
98
|
- request:
|
71
99
|
method: delete
|
72
|
-
uri: https://cartodb-rb-client.cartodb.com/api/v1/tables/
|
100
|
+
uri: https://cartodb-rb-client.cartodb.com/api/v1/tables/table_2?api_key=242015a0c60666b5cdff0ce614334668817b52ac
|
73
101
|
body:
|
74
102
|
encoding: US-ASCII
|
75
103
|
string: ''
|
76
104
|
headers:
|
77
105
|
Accept:
|
78
|
-
- *
|
79
|
-
Authorization:
|
80
|
-
- OAuth oauth_consumer_key="0gRpcgKQK8bpcvSzM5ED4NqaSbNQ8ivS4q0pVdJF", oauth_nonce="ln36GI7sCB4fvICNlnZYyw3QPGDyTsllbbGqgpdzU",
|
81
|
-
oauth_signature="UvNC9nLmY80ddXMUUfXap8EVxww%3D", oauth_signature_method="HMAC-SHA1",
|
82
|
-
oauth_timestamp="1337788390", oauth_token="7PalByYmKY8Dzh76fnt05e0YPXRJino0dyqHZYCw",
|
83
|
-
oauth_version="1.0"
|
106
|
+
- *70175296087520
|
84
107
|
response:
|
85
108
|
status:
|
86
109
|
code: 200
|
87
|
-
message:
|
110
|
+
message: !binary |-
|
111
|
+
T0s=
|
88
112
|
headers:
|
89
|
-
|
90
|
-
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
-
|
109
|
-
|
110
|
-
|
111
|
-
-
|
112
|
-
|
113
|
-
|
113
|
+
!binary "U2VydmVy":
|
114
|
+
- !binary |-
|
115
|
+
bmdpbng=
|
116
|
+
!binary "RGF0ZQ==":
|
117
|
+
- !binary |-
|
118
|
+
TW9uLCAyMCBBdWcgMjAxMiAxMDo1ODozMCBHTVQ=
|
119
|
+
!binary "Q29udGVudC1UeXBl":
|
120
|
+
- !binary |-
|
121
|
+
YXBwbGljYXRpb24vanNvbjsgY2hhcnNldD11dGYtOA==
|
122
|
+
!binary "VHJhbnNmZXItRW5jb2Rpbmc=":
|
123
|
+
- !binary |-
|
124
|
+
Y2h1bmtlZA==
|
125
|
+
!binary "Q29ubmVjdGlvbg==":
|
126
|
+
- !binary |-
|
127
|
+
a2VlcC1hbGl2ZQ==
|
128
|
+
!binary "VmFyeQ==":
|
129
|
+
- !binary |-
|
130
|
+
QWNjZXB0LUVuY29kaW5n
|
131
|
+
!binary "U3RhdHVz":
|
132
|
+
- !binary |-
|
133
|
+
MjAwIE9L
|
134
|
+
!binary "Q2FjaGUtQ29udHJvbA==":
|
135
|
+
- !binary |-
|
136
|
+
bm8tY2FjaGU=
|
137
|
+
!binary "WC1VYS1Db21wYXRpYmxl":
|
138
|
+
- !binary |-
|
139
|
+
SUU9RWRnZSxjaHJvbWU9MQ==
|
140
|
+
!binary "U2V0LUNvb2tpZQ==":
|
141
|
+
- !binary |-
|
142
|
+
X2NhcnRvZGJfc2Vzc2lvbj1CQWg3QjBraUQzTmxjM05wYjI1ZmFXUUdPZ1pG
|
143
|
+
UmlJbE16TXhNakE1T1dGalkyVTNaVFk1TWpFd01ETTFOR0poTnpVek0yWXdP
|
144
|
+
VEJKSWlaM1lYSmtaVzR1ZFhObGNpNWpZWEowYjJSaUxYSmlMV05zYVdWdWRD
|
145
|
+
NXJaWGtHT3dCVVNTSVdZMkZ5ZEc5a1lpMXlZaTFqYkdsbGJuUUdPd0JVLS1m
|
146
|
+
MDMzNTY2MTc0NjhiNmE0MzYxMjY4ZjkxNzA0M2VjYTVkZDg0MTczOyBkb21h
|
147
|
+
aW49LmNhcnRvZGIuY29tOyBwYXRoPS87IEh0dHBPbmx5
|
148
|
+
!binary "WC1SdW50aW1l":
|
149
|
+
- !binary |-
|
150
|
+
MC4xODAzMDI=
|
151
|
+
!binary "Q29udGVudC1FbmNvZGluZw==":
|
152
|
+
- !binary |-
|
153
|
+
Z3ppcA==
|
114
154
|
body:
|
115
155
|
encoding: ASCII-8BIT
|
116
|
-
string: !
|
117
|
-
|
118
|
-
|
156
|
+
string: !binary |-
|
157
|
+
IA==
|
158
|
+
http_version: !binary |-
|
159
|
+
MS4x
|
160
|
+
recorded_at: Mon, 20 Aug 2012 10:58:30 GMT
|
119
161
|
- request:
|
120
162
|
method: delete
|
121
|
-
uri: https://cartodb-rb-client.cartodb.com/api/v1/tables/
|
163
|
+
uri: https://cartodb-rb-client.cartodb.com/api/v1/tables/table_1?api_key=242015a0c60666b5cdff0ce614334668817b52ac
|
122
164
|
body:
|
123
165
|
encoding: US-ASCII
|
124
166
|
string: ''
|
125
167
|
headers:
|
126
168
|
Accept:
|
127
|
-
- *
|
128
|
-
Authorization:
|
129
|
-
- OAuth oauth_consumer_key="0gRpcgKQK8bpcvSzM5ED4NqaSbNQ8ivS4q0pVdJF", oauth_nonce="rNWAVHzmRIM6RxJTJKfjoAfkB4SNiLsxlSaIAFKdk",
|
130
|
-
oauth_signature="R2S1Q6coDbFdsBItWqu1sv3s9Wg%3D", oauth_signature_method="HMAC-SHA1",
|
131
|
-
oauth_timestamp="1337788390", oauth_token="7PalByYmKY8Dzh76fnt05e0YPXRJino0dyqHZYCw",
|
132
|
-
oauth_version="1.0"
|
169
|
+
- *70175296087520
|
133
170
|
response:
|
134
171
|
status:
|
135
172
|
code: 200
|
136
|
-
message:
|
173
|
+
message: !binary |-
|
174
|
+
T0s=
|
137
175
|
headers:
|
138
|
-
|
139
|
-
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
-
|
158
|
-
|
159
|
-
|
160
|
-
-
|
161
|
-
|
162
|
-
|
176
|
+
!binary "U2VydmVy":
|
177
|
+
- !binary |-
|
178
|
+
bmdpbng=
|
179
|
+
!binary "RGF0ZQ==":
|
180
|
+
- !binary |-
|
181
|
+
TW9uLCAyMCBBdWcgMjAxMiAxMDo1ODozMCBHTVQ=
|
182
|
+
!binary "Q29udGVudC1UeXBl":
|
183
|
+
- !binary |-
|
184
|
+
YXBwbGljYXRpb24vanNvbjsgY2hhcnNldD11dGYtOA==
|
185
|
+
!binary "VHJhbnNmZXItRW5jb2Rpbmc=":
|
186
|
+
- !binary |-
|
187
|
+
Y2h1bmtlZA==
|
188
|
+
!binary "Q29ubmVjdGlvbg==":
|
189
|
+
- !binary |-
|
190
|
+
a2VlcC1hbGl2ZQ==
|
191
|
+
!binary "VmFyeQ==":
|
192
|
+
- !binary |-
|
193
|
+
QWNjZXB0LUVuY29kaW5n
|
194
|
+
!binary "U3RhdHVz":
|
195
|
+
- !binary |-
|
196
|
+
MjAwIE9L
|
197
|
+
!binary "Q2FjaGUtQ29udHJvbA==":
|
198
|
+
- !binary |-
|
199
|
+
bm8tY2FjaGU=
|
200
|
+
!binary "WC1VYS1Db21wYXRpYmxl":
|
201
|
+
- !binary |-
|
202
|
+
SUU9RWRnZSxjaHJvbWU9MQ==
|
203
|
+
!binary "U2V0LUNvb2tpZQ==":
|
204
|
+
- !binary |-
|
205
|
+
X2NhcnRvZGJfc2Vzc2lvbj1CQWg3QjBraUQzTmxjM05wYjI1ZmFXUUdPZ1pG
|
206
|
+
UmlJbE56Z3hZelJsT0RCbU9URTROak00WWpBNU5qQTROekkwTWpJd1l6TmtZ
|
207
|
+
V1JKSWlaM1lYSmtaVzR1ZFhObGNpNWpZWEowYjJSaUxYSmlMV05zYVdWdWRD
|
208
|
+
NXJaWGtHT3dCVVNTSVdZMkZ5ZEc5a1lpMXlZaTFqYkdsbGJuUUdPd0JVLS1i
|
209
|
+
OGRjYjRiMmM2NGIyZmY5N2Y0NDJmYWE4Y2Y1M2YxZDg2Y2VmMDZlOyBkb21h
|
210
|
+
aW49LmNhcnRvZGIuY29tOyBwYXRoPS87IEh0dHBPbmx5
|
211
|
+
!binary "WC1SdW50aW1l":
|
212
|
+
- !binary |-
|
213
|
+
MC4xODk1NTY=
|
214
|
+
!binary "Q29udGVudC1FbmNvZGluZw==":
|
215
|
+
- !binary |-
|
216
|
+
Z3ppcA==
|
163
217
|
body:
|
164
218
|
encoding: ASCII-8BIT
|
165
|
-
string: !
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
|
170
|
-
|
171
|
-
body:
|
172
|
-
encoding: US-ASCII
|
173
|
-
string: ''
|
174
|
-
headers:
|
175
|
-
Accept:
|
176
|
-
- *70347547176260
|
177
|
-
Authorization:
|
178
|
-
- OAuth oauth_consumer_key="0gRpcgKQK8bpcvSzM5ED4NqaSbNQ8ivS4q0pVdJF", oauth_nonce="m6fXY1zPmR8pp3DVhFwDfdw5Bt95gCiJEQVvZk1Y",
|
179
|
-
oauth_signature="K48l97G6kcKiben9SIquhTEs75s%3D", oauth_signature_method="HMAC-SHA1",
|
180
|
-
oauth_timestamp="1337788391", oauth_token="7PalByYmKY8Dzh76fnt05e0YPXRJino0dyqHZYCw",
|
181
|
-
oauth_version="1.0"
|
182
|
-
response:
|
183
|
-
status:
|
184
|
-
code: 200
|
185
|
-
message: OK
|
186
|
-
headers:
|
187
|
-
Server:
|
188
|
-
- nginx
|
189
|
-
Date:
|
190
|
-
- Wed, 23 May 2012 15:53:11 GMT
|
191
|
-
Content-Type:
|
192
|
-
- application/json; charset=utf-8
|
193
|
-
Transfer-Encoding:
|
194
|
-
- chunked
|
195
|
-
Connection:
|
196
|
-
- keep-alive
|
197
|
-
Vary:
|
198
|
-
- Accept-Encoding
|
199
|
-
Status:
|
200
|
-
- 200 OK
|
201
|
-
Cache-Control:
|
202
|
-
- no-cache
|
203
|
-
X-Ua-Compatible:
|
204
|
-
- IE=Edge,chrome=1
|
205
|
-
Set-Cookie:
|
206
|
-
- _cartodb_session=BAh7B0kiD3Nlc3Npb25faWQGOgZFRiIlMDAyNmQ4YTcxYzVlNmFkMzlhMTVhZmY4M2U2ZDg4OTFJIiZ3YXJkZW4udXNlci5jYXJ0b2RiLXJiLWNsaWVudC5rZXkGOwBUSSIWY2FydG9kYi1yYi1jbGllbnQGOwBU--f3852a6af7a2cac08662f993c97bb4e5361ce2cf;
|
207
|
-
domain=.cartodb.com; path=/; HttpOnly
|
208
|
-
X-Runtime:
|
209
|
-
- '0.149254'
|
210
|
-
Content-Encoding:
|
211
|
-
- gzip
|
212
|
-
body:
|
213
|
-
encoding: ASCII-8BIT
|
214
|
-
string: ! ' '
|
215
|
-
http_version: '1.1'
|
216
|
-
recorded_at: Wed, 23 May 2012 15:53:11 GMT
|
217
|
-
- request:
|
218
|
-
method: delete
|
219
|
-
uri: https://cartodb-rb-client.cartodb.com/api/v1/tables/table_1?
|
220
|
-
body:
|
221
|
-
encoding: US-ASCII
|
222
|
-
string: ''
|
223
|
-
headers:
|
224
|
-
Accept:
|
225
|
-
- *70347547176260
|
226
|
-
Authorization:
|
227
|
-
- OAuth oauth_consumer_key="0gRpcgKQK8bpcvSzM5ED4NqaSbNQ8ivS4q0pVdJF", oauth_nonce="W9qeZVUT7etENgwtN6zsPZ2IgF1dmug3qyU4qDS6M",
|
228
|
-
oauth_signature="zY9gsWDwRR6fw2otdtxuxHOuhaY%3D", oauth_signature_method="HMAC-SHA1",
|
229
|
-
oauth_timestamp="1337788391", oauth_token="7PalByYmKY8Dzh76fnt05e0YPXRJino0dyqHZYCw",
|
230
|
-
oauth_version="1.0"
|
231
|
-
response:
|
232
|
-
status:
|
233
|
-
code: 200
|
234
|
-
message: OK
|
235
|
-
headers:
|
236
|
-
Server:
|
237
|
-
- nginx
|
238
|
-
Date:
|
239
|
-
- Wed, 23 May 2012 15:53:11 GMT
|
240
|
-
Content-Type:
|
241
|
-
- application/json; charset=utf-8
|
242
|
-
Transfer-Encoding:
|
243
|
-
- chunked
|
244
|
-
Connection:
|
245
|
-
- keep-alive
|
246
|
-
Vary:
|
247
|
-
- Accept-Encoding
|
248
|
-
Status:
|
249
|
-
- 200 OK
|
250
|
-
Cache-Control:
|
251
|
-
- no-cache
|
252
|
-
X-Ua-Compatible:
|
253
|
-
- IE=Edge,chrome=1
|
254
|
-
Set-Cookie:
|
255
|
-
- _cartodb_session=BAh7B0kiD3Nlc3Npb25faWQGOgZFRiIlN2JkZTQxZDhiYTFiM2IyMDkyYzMxODVhMGMyMGU2YjBJIiZ3YXJkZW4udXNlci5jYXJ0b2RiLXJiLWNsaWVudC5rZXkGOwBUSSIWY2FydG9kYi1yYi1jbGllbnQGOwBU--f0017b0d727604edaeb1a3d0c70d6d12adc50cf4;
|
256
|
-
domain=.cartodb.com; path=/; HttpOnly
|
257
|
-
X-Runtime:
|
258
|
-
- '0.177177'
|
259
|
-
Content-Encoding:
|
260
|
-
- gzip
|
261
|
-
body:
|
262
|
-
encoding: ASCII-8BIT
|
263
|
-
string: ! ' '
|
264
|
-
http_version: '1.1'
|
265
|
-
recorded_at: Wed, 23 May 2012 15:53:11 GMT
|
266
|
-
recorded_with: VCR 2.1.1
|
219
|
+
string: !binary |-
|
220
|
+
IA==
|
221
|
+
http_version: !binary |-
|
222
|
+
MS4x
|
223
|
+
recorded_at: Mon, 20 Aug 2012 10:58:30 GMT
|
224
|
+
recorded_with: VCR 2.2.4
|
data/spec/spec_helper.rb
CHANGED
@@ -1,101 +1,54 @@
|
|
1
1
|
require 'rubygems'
|
2
|
-
require 'spork'
|
3
|
-
#uncomment the following line to use spork with the debugger
|
4
|
-
#require 'spork/ext/ruby-debug'
|
5
2
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
c.cassette_library_dir = 'spec/fixtures/cassettes'
|
44
|
-
c.hook_into :typhoeus
|
45
|
-
#c.preserve_exact_body_bytes
|
46
|
-
c.configure_rspec_metadata!
|
47
|
-
end
|
3
|
+
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
4
|
+
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
5
|
+
require 'rspec'
|
6
|
+
require 'yaml'
|
7
|
+
require 'cartodb-rb-client'
|
8
|
+
require 'cartodb-rb-client/cartodb'
|
9
|
+
require 'active_support/core_ext/array/random_access.rb'
|
10
|
+
|
11
|
+
cartodb_config = {
|
12
|
+
'host' => 'https://cartodb-rb-client.cartodb.com',
|
13
|
+
'oauth_key' => ENV['CARTODB_OAUTH_KEY'],
|
14
|
+
'oauth_secret' => ENV['CARTODB_OAUTH_SECRET'],
|
15
|
+
'username' => ENV['CARTODB_USERNAME'],
|
16
|
+
'password' => ENV['CARTODB_PASSWORD']
|
17
|
+
}
|
18
|
+
|
19
|
+
if File.exists?("#{File.dirname(__FILE__)}/support/cartodb_config.yml")
|
20
|
+
cartodb_config = YAML.load_file("#{File.dirname(__FILE__)}/support/cartodb_config.yml")
|
21
|
+
end
|
22
|
+
CartoDB::Settings = cartodb_config
|
23
|
+
CartoDB::Connection = CartoDB::Client::Connection::Base.new unless defined? CartoDB::Connection
|
24
|
+
# CartoDB::Settings = YAML.load_file("#{File.dirname(__FILE__)}/support/database.yml") unless defined? CartoDB::Settings
|
25
|
+
# CartoDB::Connection = CartoDB::Client::Connection::Base.new unless defined? CartoDB::Connection
|
26
|
+
|
27
|
+
RgeoFactory = ::RGeo::Geographic.spherical_factory(:srid => 4326)
|
28
|
+
|
29
|
+
require "#{File.dirname(__FILE__)}/support/cartodb_helpers.rb"
|
30
|
+
require "#{File.dirname(__FILE__)}/support/cartodb_factories.rb"
|
31
|
+
|
32
|
+
require 'vcr'
|
33
|
+
VCR.configure do |c|
|
34
|
+
c.default_cassette_options = { :record => :new_episodes }
|
35
|
+
c.cassette_library_dir = 'spec/fixtures/cassettes'
|
36
|
+
c.hook_into :typhoeus
|
37
|
+
#c.preserve_exact_body_bytes
|
38
|
+
c.configure_rspec_metadata!
|
39
|
+
end
|
48
40
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
end
|
41
|
+
RSpec.configure do |config|
|
42
|
+
config.before(:each) do
|
43
|
+
VCR.use_cassette('clean tables') do
|
44
|
+
drop_all_cartodb_tables
|
54
45
|
end
|
46
|
+
end
|
55
47
|
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
end
|
48
|
+
config.after(:all) do
|
49
|
+
VCR.use_cassette('clean tables') do
|
50
|
+
drop_all_cartodb_tables
|
60
51
|
end
|
61
|
-
|
62
52
|
end
|
63
|
-
end
|
64
|
-
|
65
|
-
Spork.each_run do
|
66
|
-
# This code will be run each time you run your specs.
|
67
53
|
|
68
54
|
end
|
69
|
-
|
70
|
-
# --- Instructions ---
|
71
|
-
# Sort the contents of this file into a Spork.prefork and a Spork.each_run
|
72
|
-
# block.
|
73
|
-
#
|
74
|
-
# The Spork.prefork block is run only once when the spork server is started.
|
75
|
-
# You typically want to place most of your (slow) initializer code in here, in
|
76
|
-
# particular, require'ing any 3rd-party gems that you don't normally modify
|
77
|
-
# during development.
|
78
|
-
#
|
79
|
-
# The Spork.each_run block is run each time you run your specs. In case you
|
80
|
-
# need to load files that tend to change during development, require them here.
|
81
|
-
# With Rails, your application modules are loaded automatically, so sometimes
|
82
|
-
# this block can remain empty.
|
83
|
-
#
|
84
|
-
# Note: You can modify files loaded *from* the Spork.each_run block without
|
85
|
-
# restarting the spork server. However, this file itself will not be reloaded,
|
86
|
-
# so if you change any of the code inside the each_run block, you still need to
|
87
|
-
# restart the server. In general, if you have non-trivial code in this file,
|
88
|
-
# it's advisable to move it into a separate file so you can easily edit it
|
89
|
-
# without restarting spork. (For example, with RSpec, you could move
|
90
|
-
# non-trivial code into a file spec/support/my_helper.rb, making sure that the
|
91
|
-
# spec/support/* files are require'd from inside the each_run block.)
|
92
|
-
#
|
93
|
-
# Any code that is left outside the two blocks will be run during preforking
|
94
|
-
# *and* during each_run -- that's probably not what you want.
|
95
|
-
#
|
96
|
-
# These instructions should self-destruct in 10 seconds. If they don't, feel
|
97
|
-
# free to delete them.
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|