simplegeo 0.4 → 0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -459,29 +459,6 @@ describe "Client" do
459
459
  end
460
460
  end
461
461
  end
462
-
463
- context "getting a nearby address" do
464
- before do
465
- stub_request :get,
466
- 'http://api.simplegeo.com/1.0/nearby/address/37.75965,-122.42608.json',
467
- :fixture_file => 'nearby_address.json'
468
- end
469
-
470
- it "should return a hash with the address information" do
471
- nearby_address = SimpleGeo::Client.get_nearby_address(37.759650000000001, -122.42608)
472
- nearby_address.should == {
473
- :state_name => "California",
474
- :street_number => "580",
475
- :country => "US",
476
- :street => "Dolores St",
477
- :postal_code => "",
478
- :county_name => "San Francisco",
479
- :county_code => "075",
480
- :state_code => "CA",
481
- :place_name => "San Francisco"
482
- }
483
- end
484
- end
485
462
 
486
463
  context "getting a context" do
487
464
  before do
@@ -550,463 +527,6 @@ describe "Client" do
550
527
  end
551
528
  end
552
529
 
553
- context "getting SpotRank information for a day, hour and location" do
554
- before do
555
- stub_request :get,
556
- 'http://api.simplegeo.com/1.0/density/sat/16/37.75965,-122.42608.json',
557
- :fixture_file => 'get_density_by_hour.json'
558
- end
559
-
560
- it "should return a hash containing the density information" do
561
- density_info = SimpleGeo::Client.get_density(37.75965, -122.42608, 'sat', '16' )
562
- density_info.should == {
563
- :city_rank => 10,
564
- :local_rank => 8,
565
- :trending_rank => 0,
566
- :dayname => "sat",
567
- :hour => 16,
568
- :worldwide_rank => 8,
569
- :geometry => {
570
- :type => "Polygon",
571
- :coordinates => [
572
- [ 37.7587890625, -122.4267578125 ],
573
- [ 37.759765625, -122.4267578125 ],
574
- [ 37.759765625, -122.42578125 ],
575
- [ 37.7587890625, -122.42578125 ],
576
- [ 37.7587890625, -122.4267578125 ]
577
- ]
578
- }
579
- }
580
- end
581
- end
582
-
583
- context "getting SpotRank information for a day and location" do
584
- before do
585
- stub_request :get,
586
- 'http://api.simplegeo.com/1.0/density/sat/37.75965,-122.42608.json',
587
- :fixture_file => 'get_density_by_day.json'
588
- end
589
-
590
- it "should return an array of hashes containing the density information" do
591
- density_info = SimpleGeo::Client.get_density(37.75965, -122.42608, 'sat')
592
- density_info.should == [
593
- {
594
- :geometry => {
595
- :type => "Polygon",
596
- :coordinates => [
597
- [ 37.7587890625, -122.4267578125 ],
598
- [ 37.759765625, -122.4267578125 ],
599
- [ 37.759765625, -122.42578125 ],
600
- [ 37.7587890625, -122.42578125 ],
601
- [ 37.7587890625, -122.4267578125 ]
602
- ]
603
- },
604
- :hour => 0,
605
- :trending_rank => 2,
606
- :local_rank => 4,
607
- :city_rank => 10,
608
- :worldwide_rank => 4,
609
- :dayname => "sat"
610
- },
611
- {
612
- :geometry => {
613
- :type => "Polygon",
614
- :coordinates => [
615
- [ 37.7587890625, -122.4267578125 ],
616
- [ 37.759765625, -122.4267578125 ],
617
- [ 37.759765625, -122.42578125 ],
618
- [ 37.7587890625, -122.42578125 ],
619
- [ 37.7587890625, -122.4267578125 ]
620
- ]
621
- },
622
- :hour => 1,
623
- :trending_rank => -2,
624
- :local_rank => 6,
625
- :city_rank => 10,
626
- :worldwide_rank => 6,
627
- :dayname => "sat"
628
- },
629
- {
630
- :geometry => {
631
- :type => "Polygon",
632
- :coordinates => [
633
- [ 37.7587890625, -122.4267578125 ],
634
- [ 37.759765625, -122.4267578125 ],
635
- [ 37.759765625, -122.42578125 ],
636
- [ 37.7587890625, -122.42578125 ],
637
- [ 37.7587890625, -122.4267578125 ]
638
- ]
639
- },
640
- :hour => 2,
641
- :trending_rank => 2,
642
- :local_rank => 2,
643
- :city_rank => 10,
644
- :worldwide_rank => 2,
645
- :dayname => "sat"
646
- },
647
- {
648
- :geometry => {
649
- :type => "Polygon",
650
- :coordinates => [
651
- [ 37.7587890625, -122.4267578125 ],
652
- [ 37.759765625, -122.4267578125 ],
653
- [ 37.759765625, -122.42578125 ],
654
- [ 37.7587890625, -122.42578125 ],
655
- [ 37.7587890625, -122.4267578125 ]
656
- ]
657
- },
658
- :hour => 3,
659
- :trending_rank => -2,
660
- :local_rank => 6,
661
- :city_rank => 10,
662
- :worldwide_rank => 6,
663
- :dayname => "sat"
664
- },
665
- {
666
- :geometry => {
667
- :type => "Polygon",
668
- :coordinates => [
669
- [ 37.7587890625, -122.4267578125 ],
670
- [ 37.759765625, -122.4267578125 ],
671
- [ 37.759765625, -122.42578125 ],
672
- [ 37.7587890625, -122.42578125 ],
673
- [ 37.7587890625, -122.4267578125 ]
674
- ]
675
- },
676
- :hour => 4,
677
- :trending_rank => -2,
678
- :local_rank => 4,
679
- :city_rank => 10,
680
- :worldwide_rank => 4,
681
- :dayname => "sat"
682
- },
683
- {
684
- :geometry => {
685
- :type => "Polygon",
686
- :coordinates => [
687
- [ 37.7587890625, -122.4267578125 ],
688
- [ 37.759765625, -122.4267578125 ],
689
- [ 37.759765625, -122.42578125 ],
690
- [ 37.7587890625, -122.42578125 ],
691
- [ 37.7587890625, -122.4267578125 ]
692
- ]
693
- },
694
- :hour => 6,
695
- :trending_rank => 2,
696
- :local_rank => 2,
697
- :city_rank => 10,
698
- :worldwide_rank => 2,
699
- :dayname => "sat"
700
- },
701
- {
702
- :geometry => {
703
- :type => "Polygon",
704
- :coordinates => [
705
- [ 37.7587890625, -122.4267578125 ],
706
- [ 37.759765625, -122.4267578125 ],
707
- [ 37.759765625, -122.42578125 ],
708
- [ 37.7587890625, -122.42578125 ],
709
- [ 37.7587890625, -122.4267578125 ]
710
- ]
711
- },
712
- :hour => 7,
713
- :trending_rank => 1,
714
- :local_rank => 5,
715
- :city_rank => 10,
716
- :worldwide_rank => 5,
717
- :dayname => "sat"
718
- },
719
- {
720
- :geometry => {
721
- :type => "Polygon",
722
- :coordinates => [
723
- [ 37.7587890625, -122.4267578125 ],
724
- [ 37.759765625, -122.4267578125 ],
725
- [ 37.759765625, -122.42578125 ],
726
- [ 37.7587890625, -122.42578125 ],
727
- [ 37.7587890625, -122.4267578125 ]
728
- ]
729
- },
730
- :hour => 8,
731
- :trending_rank => 0,
732
- :local_rank => 6,
733
- :city_rank => 10,
734
- :worldwide_rank => 6,
735
- :dayname => "sat"
736
- },
737
- {
738
- :geometry => {
739
- :type => "Polygon",
740
- :coordinates => [
741
- [ 37.7587890625, -122.4267578125 ],
742
- [ 37.759765625, -122.4267578125 ],
743
- [ 37.759765625, -122.42578125 ],
744
- [ 37.7587890625, -122.42578125 ],
745
- [ 37.7587890625, -122.4267578125 ]
746
- ]
747
- },
748
- :hour => 9,
749
- :trending_rank => 0,
750
- :local_rank => 6,
751
- :city_rank => 10,
752
- :worldwide_rank => 6,
753
- :dayname => "sat"
754
- },
755
- {
756
- :geometry => {
757
- :type => "Polygon",
758
- :coordinates => [
759
- [ 37.7587890625, -122.4267578125 ],
760
- [ 37.759765625, -122.4267578125 ],
761
- [ 37.759765625, -122.42578125 ],
762
- [ 37.7587890625, -122.42578125 ],
763
- [ 37.7587890625, -122.4267578125 ]
764
- ]
765
- },
766
- :hour => 10,
767
- :trending_rank => 2,
768
- :local_rank => 6,
769
- :city_rank => 10,
770
- :worldwide_rank => 6,
771
- :dayname => "sat"
772
- },
773
- {
774
- :geometry => {
775
- :type => "Polygon",
776
- :coordinates => [
777
- [ 37.7587890625, -122.4267578125 ],
778
- [ 37.759765625, -122.4267578125 ],
779
- [ 37.759765625, -122.42578125 ],
780
- [ 37.7587890625, -122.42578125 ],
781
- [ 37.7587890625, -122.4267578125 ]
782
- ]
783
- },
784
- :hour => 11,
785
- :trending_rank => -1,
786
- :local_rank => 8,
787
- :city_rank => 10,
788
- :worldwide_rank => 8,
789
- :dayname => "sat"
790
- },
791
- {
792
- :geometry => {
793
- :type => "Polygon",
794
- :coordinates => [
795
- [ 37.7587890625, -122.4267578125 ],
796
- [ 37.759765625, -122.4267578125 ],
797
- [ 37.759765625, -122.42578125 ],
798
- [ 37.7587890625, -122.42578125 ],
799
- [ 37.7587890625, -122.4267578125 ]
800
- ]
801
- },
802
- :hour => 12,
803
- :trending_rank => 1,
804
- :local_rank => 7,
805
- :city_rank => 10,
806
- :worldwide_rank => 7,
807
- :dayname => "sat"
808
- },
809
- {
810
- :geometry => {
811
- :type => "Polygon",
812
- :coordinates => [
813
- [ 37.7587890625, -122.4267578125 ],
814
- [ 37.759765625, -122.4267578125 ],
815
- [ 37.759765625, -122.42578125 ],
816
- [ 37.7587890625, -122.42578125 ],
817
- [ 37.7587890625, -122.4267578125 ]
818
- ]
819
- },
820
- :hour => 13,
821
- :trending_rank => 0,
822
- :local_rank => 8,
823
- :city_rank => 10,
824
- :worldwide_rank => 8,
825
- :dayname => "sat"
826
- },
827
- {
828
- :geometry => {
829
- :type => "Polygon",
830
- :coordinates => [
831
- [ 37.7587890625, -122.4267578125 ],
832
- [ 37.759765625, -122.4267578125 ],
833
- [ 37.759765625, -122.42578125 ],
834
- [ 37.7587890625, -122.42578125 ],
835
- [ 37.7587890625, -122.4267578125 ]
836
- ]
837
- },
838
- :hour => 14,
839
- :trending_rank => 0,
840
- :local_rank => 8,
841
- :city_rank => 10,
842
- :worldwide_rank => 8,
843
- :dayname => "sat"
844
- },
845
- {
846
- :geometry => {
847
- :type => "Polygon",
848
- :coordinates => [
849
- [ 37.7587890625, -122.4267578125 ],
850
- [ 37.759765625, -122.4267578125 ],
851
- [ 37.759765625, -122.42578125 ],
852
- [ 37.7587890625, -122.42578125 ],
853
- [ 37.7587890625, -122.4267578125 ]
854
- ]
855
- },
856
- :hour => 15,
857
- :trending_rank => 0,
858
- :local_rank => 8,
859
- :city_rank => 10,
860
- :worldwide_rank => 8,
861
- :dayname => "sat"
862
- },
863
- {
864
- :geometry => {
865
- :type => "Polygon",
866
- :coordinates => [
867
- [ 37.7587890625, -122.4267578125 ],
868
- [ 37.759765625, -122.4267578125 ],
869
- [ 37.759765625, -122.42578125 ],
870
- [ 37.7587890625, -122.42578125 ],
871
- [ 37.7587890625, -122.4267578125 ]
872
- ]
873
- },
874
- :hour => 16,
875
- :trending_rank => 0,
876
- :local_rank => 8,
877
- :city_rank => 10,
878
- :worldwide_rank => 8,
879
- :dayname => "sat"
880
- },
881
- {
882
- :geometry => {
883
- :type => "Polygon",
884
- :coordinates => [
885
- [ 37.7587890625, -122.4267578125 ],
886
- [ 37.759765625, -122.4267578125 ],
887
- [ 37.759765625, -122.42578125 ],
888
- [ 37.7587890625, -122.42578125 ],
889
- [ 37.7587890625, -122.4267578125 ]
890
- ]
891
- },
892
- :hour => 17,
893
- :trending_rank => 0,
894
- :local_rank => 8,
895
- :city_rank => 10,
896
- :worldwide_rank => 8,
897
- :dayname => "sat"
898
- },
899
- {
900
- :geometry => {
901
- :type => "Polygon",
902
- :coordinates => [
903
- [ 37.7587890625, -122.4267578125 ],
904
- [ 37.759765625, -122.4267578125 ],
905
- [ 37.759765625, -122.42578125 ],
906
- [ 37.7587890625, -122.42578125 ],
907
- [ 37.7587890625, -122.4267578125 ]
908
- ]
909
- },
910
- :hour => 18,
911
- :trending_rank => 0,
912
- :local_rank => 8,
913
- :city_rank => 10,
914
- :worldwide_rank => 8,
915
- :dayname => "sat"
916
- },
917
- {
918
- :geometry => {
919
- :type => "Polygon",
920
- :coordinates => [
921
- [ 37.7587890625, -122.4267578125 ],
922
- [ 37.759765625, -122.4267578125 ],
923
- [ 37.759765625, -122.42578125 ],
924
- [ 37.7587890625, -122.42578125 ],
925
- [ 37.7587890625, -122.4267578125 ]
926
- ]
927
- },
928
- :hour => 19,
929
- :trending_rank => 0,
930
- :local_rank => 8,
931
- :city_rank => 10,
932
- :worldwide_rank => 8,
933
- :dayname => "sat"
934
- },
935
- {
936
- :geometry => {
937
- :type => "Polygon",
938
- :coordinates => [
939
- [ 37.7587890625, -122.4267578125 ],
940
- [ 37.759765625, -122.4267578125 ],
941
- [ 37.759765625, -122.42578125 ],
942
- [ 37.7587890625, -122.42578125 ],
943
- [ 37.7587890625, -122.4267578125 ]
944
- ]
945
- },
946
- :hour => 20,
947
- :trending_rank => 0,
948
- :local_rank => 8,
949
- :city_rank => 10,
950
- :worldwide_rank => 8,
951
- :dayname => "sat"
952
- },
953
- {
954
- :geometry => {
955
- :type => "Polygon",
956
- :coordinates => [
957
- [ 37.7587890625, -122.4267578125 ],
958
- [ 37.759765625, -122.4267578125 ],
959
- [ 37.759765625, -122.42578125 ],
960
- [ 37.7587890625, -122.42578125 ],
961
- [ 37.7587890625, -122.4267578125 ]
962
- ]
963
- },
964
- :hour => 21,
965
- :trending_rank => -2,
966
- :local_rank => 8,
967
- :city_rank => 10,
968
- :worldwide_rank => 8,
969
- :dayname => "sat"
970
- },
971
- {
972
- :geometry => {
973
- :type => "Polygon",
974
- :coordinates => [
975
- [ 37.7587890625, -122.4267578125 ],
976
- [ 37.759765625, -122.4267578125 ],
977
- [ 37.759765625, -122.42578125 ],
978
- [ 37.7587890625, -122.42578125 ],
979
- [ 37.7587890625, -122.4267578125 ]
980
- ]
981
- },
982
- :hour => 22,
983
- :trending_rank => 0,
984
- :local_rank => 5,
985
- :city_rank => 10,
986
- :worldwide_rank => 6,
987
- :dayname => "sat"
988
- },
989
- {
990
- :geometry => {
991
- :type => "Polygon",
992
- :coordinates => [
993
- [ 37.7587890625, -122.4267578125 ],
994
- [ 37.759765625, -122.4267578125 ],
995
- [ 37.759765625, -122.42578125 ],
996
- [ 37.7587890625, -122.42578125 ],
997
- [ 37.7587890625, -122.4267578125 ]
998
- ]
999
- },
1000
- :hour => 23,
1001
- :trending_rank => 1,
1002
- :local_rank => 5,
1003
- :city_rank => 10,
1004
- :worldwide_rank => 5,
1005
- :dayname => "sat"
1006
- }
1007
- ]
1008
- end
1009
- end
1010
530
 
1011
531
  context "getting contains info for a set of coordinates" do
1012
532
  before do
@@ -1139,73 +659,4 @@ describe "Client" do
1139
659
  end
1140
660
  end
1141
661
 
1142
- context "getting overlaps info for a set of coordinates" do
1143
- before do
1144
- stub_request :get,
1145
- 'http://api.simplegeo.com/1.0/overlaps/32.528832,-124.482003,42.009517,-114.131211.json',
1146
- :fixture_file => 'overlaps.json'
1147
- end
1148
-
1149
- it "should return a hash with the correct info" do
1150
- info = SimpleGeo::Client.get_overlaps(32.528832000000001, -124.48200299999999,
1151
- 42.009516999999995, -114.13121099999999)
1152
- info.should == [
1153
- {
1154
- :bounds =>
1155
- [
1156
- -122.998802,
1157
- 42.002634,
1158
- -122.597843,
1159
- 42.266379000000001
1160
- ],
1161
- :type => "Census Tract",
1162
- :id => "Census_Tract:41029002300:9r2xt4",
1163
- :abbr => "",
1164
- :name => "41029002300"
1165
- },
1166
- {
1167
- :bounds =>
1168
- [
1169
- -123.858086,
1170
- 41.995095999999997,
1171
- -123.22998200000001,
1172
- 42.272435999999999
1173
- ],
1174
- :type => "Census Tract",
1175
- :id => "Census_Tract:41033361600:9r2psc",
1176
- :abbr => "",
1177
- :name => "41033361600"
1178
- },
1179
- {
1180
- :bounds =>
1181
- [
1182
- -123.231629,
1183
- 42.003022000000001,
1184
- -122.907515,
1185
- 42.433349
1186
- ],
1187
- :type => "Census Tract",
1188
- :id => "Census_Tract:41029003002:9r2ryf",
1189
- :abbr => "",
1190
- :name => "41029003002"
1191
- }
1192
- ]
1193
- end
1194
- end
1195
-
1196
- # this API call seems to always return a 404
1197
- # context "getting boundary info by id" do
1198
- # before do
1199
- # stub_request :get,
1200
- # 'http://api.simplegeo.com/1.0/boundary/Neighborhood:Mission_Dolores:9q8yy4.json',
1201
- # :fixture_file => 'boundary.json'
1202
- # end
1203
- #
1204
- # it "should return a hash with the correct info" do
1205
- # info = SimpleGeo::Client.get_boundary("Neighborhood:Mission_Dolores:9q8yy4")
1206
- # info.should == [
1207
- #
1208
- # ]
1209
- # end
1210
- # end
1211
662
  end