panoramio-rb 0.0.8 → 1.0.0
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.
- data/README.rdoc +49 -3
 - data/lib/panoramio-rb/version.rb +1 -1
 - data/lib/panoramio-rb.rb +12 -0
 - metadata +24 -13
 
    
        data/README.rdoc
    CHANGED
    
    | 
         @@ -14,10 +14,40 @@ Or by command line 
     | 
|
| 
       14 
14 
     | 
    
         
             
            == Usage
         
     | 
| 
       15 
15 
     | 
    
         
             
              require 'rubygems'
         
     | 
| 
       16 
16 
     | 
    
         
             
              require 'panoramio-rb'
         
     | 
| 
       17 
     | 
    
         
            -
              panoramio = PanoramioRb.get_panoramas( 
     | 
| 
       18 
     | 
    
         
            -
             
     | 
| 
      
 17 
     | 
    
         
            +
              panoramio = PanoramioRb.get_panoramas(
         
     | 
| 
      
 18 
     | 
    
         
            +
                :minx=>'-72.69483717012992',
         
     | 
| 
      
 19 
     | 
    
         
            +
                :miny=>'-13.307931783110847',
         
     | 
| 
      
 20 
     | 
    
         
            +
                :maxx=>'-72.39756282987008',
         
     | 
| 
      
 21 
     | 
    
         
            +
                :maxy=>'-13.018468216889152')
         
     | 
| 
      
 22 
     | 
    
         
            +
              
         
     | 
| 
      
 23 
     | 
    
         
            +
              # Or use
         
     | 
| 
      
 24 
     | 
    
         
            +
              panoramio = PanoramioRb.get_panoramas_from_point([-13.1632,-72.5462])
         
     | 
| 
      
 25 
     | 
    
         
            +
              
         
     | 
| 
      
 26 
     | 
    
         
            +
              # To get photos
         
     | 
| 
      
 27 
     | 
    
         
            +
              panoramio.photos
         
     | 
| 
      
 28 
     | 
    
         
            +
              
         
     | 
| 
      
 29 
     | 
    
         
            +
              # To get global total photos
         
     | 
| 
      
 30 
     | 
    
         
            +
              panoramio[:count]
         
     | 
| 
      
 31 
     | 
    
         
            +
              
         
     | 
| 
      
 32 
     | 
    
         
            +
              # To verify if has more photos
         
     | 
| 
      
 33 
     | 
    
         
            +
              panoramio.has_more
         
     | 
| 
       19 
34 
     | 
    
         | 
| 
       20 
     | 
    
         
            -
             
     | 
| 
      
 35 
     | 
    
         
            +
              # Photos structure:
         
     | 
| 
      
 36 
     | 
    
         
            +
              photo = panoramio.photos.first
         
     | 
| 
      
 37 
     | 
    
         
            +
              photo.photo_id
         
     | 
| 
      
 38 
     | 
    
         
            +
              photo.photo_title
         
     | 
| 
      
 39 
     | 
    
         
            +
              photo.photo_url
         
     | 
| 
      
 40 
     | 
    
         
            +
              photo.photo_file_url
         
     | 
| 
      
 41 
     | 
    
         
            +
              photo.longitude
         
     | 
| 
      
 42 
     | 
    
         
            +
              photo.latitude
         
     | 
| 
      
 43 
     | 
    
         
            +
              photo.width
         
     | 
| 
      
 44 
     | 
    
         
            +
              photo.height
         
     | 
| 
      
 45 
     | 
    
         
            +
              photo.upload_date
         
     | 
| 
      
 46 
     | 
    
         
            +
              photo.owner_id
         
     | 
| 
      
 47 
     | 
    
         
            +
              photo.owner_name
         
     | 
| 
      
 48 
     | 
    
         
            +
              photo.owner_url
         
     | 
| 
      
 49 
     | 
    
         
            +
             
     | 
| 
      
 50 
     | 
    
         
            +
            === Options for get_panoramas function
         
     | 
| 
       21 
51 
     | 
    
         
             
              :set
         
     | 
| 
       22 
52 
     | 
    
         
             
                Type of photos. Use :public (by default) for popular photos, :full to get all photos, or a Panoramio User ID.
         
     | 
| 
       23 
53 
     | 
    
         | 
| 
         @@ -38,3 +68,19 @@ Or by command line 
     | 
|
| 
       38 
68 
     | 
    
         
             
              :minx, :miny, :maxx, and :maxy
         
     | 
| 
       39 
69 
     | 
    
         
             
                This values define the area to show photos from (minimum longitude, latitude, maximum longitude
         
     | 
| 
       40 
70 
     | 
    
         
             
                and latitude, respectively).
         
     | 
| 
      
 71 
     | 
    
         
            +
            === Options for get_panoramas_from_point function
         
     | 
| 
      
 72 
     | 
    
         
            +
              :point
         
     | 
| 
      
 73 
     | 
    
         
            +
                Array with Latitude, Longitude values
         
     | 
| 
      
 74 
     | 
    
         
            +
              :radius
         
     | 
| 
      
 75 
     | 
    
         
            +
                Distance from point. Default 10
         
     | 
| 
      
 76 
     | 
    
         
            +
              :unit
         
     | 
| 
      
 77 
     | 
    
         
            +
                Distance unit. Default :mi (miles). You can use too kilometers (:km)
         
     | 
| 
      
 78 
     | 
    
         
            +
              :options
         
     | 
| 
      
 79 
     | 
    
         
            +
                Hash values. The same options for get_panoramas function
         
     | 
| 
      
 80 
     | 
    
         
            +
             
     | 
| 
      
 81 
     | 
    
         
            +
            == Resources
         
     | 
| 
      
 82 
     | 
    
         
            +
            * Panoramio API: http://www.panoramio.com/api/data/api.html
         
     | 
| 
      
 83 
     | 
    
         
            +
            * Panoramio API Terms of Service: http://www.panoramio.com/api/data/terms.html
         
     | 
| 
      
 84 
     | 
    
         
            +
             
     | 
| 
      
 85 
     | 
    
         
            +
            == TODO
         
     | 
| 
      
 86 
     | 
    
         
            +
            * Make Tests :$
         
     | 
    
        data/lib/panoramio-rb/version.rb
    CHANGED
    
    
    
        data/lib/panoramio-rb.rb
    CHANGED
    
    | 
         @@ -2,6 +2,7 @@ require 'rubygems' 
     | 
|
| 
       2 
2 
     | 
    
         
             
            require 'json'
         
     | 
| 
       3 
3 
     | 
    
         
             
            require 'hashie'
         
     | 
| 
       4 
4 
     | 
    
         
             
            require 'rest_client'
         
     | 
| 
      
 5 
     | 
    
         
            +
            require 'geocoder/calculations'
         
     | 
| 
       5 
6 
     | 
    
         | 
| 
       6 
7 
     | 
    
         
             
            module PanoramioRb
         
     | 
| 
       7 
8 
     | 
    
         
             
              URL = 'http://www.panoramio.com/map/get_panoramas.php'
         
     | 
| 
         @@ -24,4 +25,15 @@ module PanoramioRb 
     | 
|
| 
       24 
25 
     | 
    
         
             
                  raise "Panoramio API error: #{response.code}. Response #{response.to_str}"
         
     | 
| 
       25 
26 
     | 
    
         
             
                end
         
     | 
| 
       26 
27 
     | 
    
         
             
              end
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
              def self.get_panoramas_from_point(point, radius = 10, unit = :mi, options = {})
         
     | 
| 
      
 30 
     | 
    
         
            +
                points = Geocoder::Calculations.bounding_box(point, radius, { :unit => unit })
         
     | 
| 
      
 31 
     | 
    
         
            +
                options.merge!({
         
     | 
| 
      
 32 
     | 
    
         
            +
                  :miny => points[0],
         
     | 
| 
      
 33 
     | 
    
         
            +
                  :minx => points[1],
         
     | 
| 
      
 34 
     | 
    
         
            +
                  :maxy => points[2],
         
     | 
| 
      
 35 
     | 
    
         
            +
                  :maxx => points[3] 
         
     | 
| 
      
 36 
     | 
    
         
            +
                })
         
     | 
| 
      
 37 
     | 
    
         
            +
                self.get_panoramas(options)
         
     | 
| 
      
 38 
     | 
    
         
            +
              end
         
     | 
| 
       27 
39 
     | 
    
         
             
            end
         
     | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: panoramio-rb
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.0 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.0.0
         
     | 
| 
       5 
5 
     | 
    
         
             
              prerelease: 
         
     | 
| 
       6 
6 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       7 
7 
     | 
    
         
             
            authors:
         
     | 
| 
         @@ -14,7 +14,7 @@ default_executable: 
     | 
|
| 
       14 
14 
     | 
    
         
             
            dependencies:
         
     | 
| 
       15 
15 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       16 
16 
     | 
    
         
             
              name: rails
         
     | 
| 
       17 
     | 
    
         
            -
              requirement: & 
     | 
| 
      
 17 
     | 
    
         
            +
              requirement: &2157662880 !ruby/object:Gem::Requirement
         
     | 
| 
       18 
18 
     | 
    
         
             
                none: false
         
     | 
| 
       19 
19 
     | 
    
         
             
                requirements:
         
     | 
| 
       20 
20 
     | 
    
         
             
                - - ~>
         
     | 
| 
         @@ -22,10 +22,10 @@ dependencies: 
     | 
|
| 
       22 
22 
     | 
    
         
             
                    version: 3.1.1
         
     | 
| 
       23 
23 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       24 
24 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       25 
     | 
    
         
            -
              version_requirements: * 
     | 
| 
      
 25 
     | 
    
         
            +
              version_requirements: *2157662880
         
     | 
| 
       26 
26 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       27 
27 
     | 
    
         
             
              name: json
         
     | 
| 
       28 
     | 
    
         
            -
              requirement: & 
     | 
| 
      
 28 
     | 
    
         
            +
              requirement: &2157662380 !ruby/object:Gem::Requirement
         
     | 
| 
       29 
29 
     | 
    
         
             
                none: false
         
     | 
| 
       30 
30 
     | 
    
         
             
                requirements:
         
     | 
| 
       31 
31 
     | 
    
         
             
                - - =
         
     | 
| 
         @@ -33,10 +33,10 @@ dependencies: 
     | 
|
| 
       33 
33 
     | 
    
         
             
                    version: 1.6.1
         
     | 
| 
       34 
34 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       35 
35 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       36 
     | 
    
         
            -
              version_requirements: * 
     | 
| 
      
 36 
     | 
    
         
            +
              version_requirements: *2157662380
         
     | 
| 
       37 
37 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       38 
38 
     | 
    
         
             
              name: hashie
         
     | 
| 
       39 
     | 
    
         
            -
              requirement: & 
     | 
| 
      
 39 
     | 
    
         
            +
              requirement: &2157661920 !ruby/object:Gem::Requirement
         
     | 
| 
       40 
40 
     | 
    
         
             
                none: false
         
     | 
| 
       41 
41 
     | 
    
         
             
                requirements:
         
     | 
| 
       42 
42 
     | 
    
         
             
                - - =
         
     | 
| 
         @@ -44,10 +44,10 @@ dependencies: 
     | 
|
| 
       44 
44 
     | 
    
         
             
                    version: 1.2.0
         
     | 
| 
       45 
45 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       46 
46 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       47 
     | 
    
         
            -
              version_requirements: * 
     | 
| 
      
 47 
     | 
    
         
            +
              version_requirements: *2157661920
         
     | 
| 
       48 
48 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       49 
49 
     | 
    
         
             
              name: rest-client
         
     | 
| 
       50 
     | 
    
         
            -
              requirement: & 
     | 
| 
      
 50 
     | 
    
         
            +
              requirement: &2157661460 !ruby/object:Gem::Requirement
         
     | 
| 
       51 
51 
     | 
    
         
             
                none: false
         
     | 
| 
       52 
52 
     | 
    
         
             
                requirements:
         
     | 
| 
       53 
53 
     | 
    
         
             
                - - =
         
     | 
| 
         @@ -55,10 +55,21 @@ dependencies: 
     | 
|
| 
       55 
55 
     | 
    
         
             
                    version: 1.6.7
         
     | 
| 
       56 
56 
     | 
    
         
             
              type: :runtime
         
     | 
| 
       57 
57 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       58 
     | 
    
         
            -
              version_requirements: * 
     | 
| 
      
 58 
     | 
    
         
            +
              version_requirements: *2157661460
         
     | 
| 
      
 59 
     | 
    
         
            +
            - !ruby/object:Gem::Dependency
         
     | 
| 
      
 60 
     | 
    
         
            +
              name: geocoder
         
     | 
| 
      
 61 
     | 
    
         
            +
              requirement: &2157681480 !ruby/object:Gem::Requirement
         
     | 
| 
      
 62 
     | 
    
         
            +
                none: false
         
     | 
| 
      
 63 
     | 
    
         
            +
                requirements:
         
     | 
| 
      
 64 
     | 
    
         
            +
                - - =
         
     | 
| 
      
 65 
     | 
    
         
            +
                  - !ruby/object:Gem::Version
         
     | 
| 
      
 66 
     | 
    
         
            +
                    version: 1.0.5
         
     | 
| 
      
 67 
     | 
    
         
            +
              type: :runtime
         
     | 
| 
      
 68 
     | 
    
         
            +
              prerelease: false
         
     | 
| 
      
 69 
     | 
    
         
            +
              version_requirements: *2157681480
         
     | 
| 
       59 
70 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       60 
71 
     | 
    
         
             
              name: sqlite3
         
     | 
| 
       61 
     | 
    
         
            -
              requirement: & 
     | 
| 
      
 72 
     | 
    
         
            +
              requirement: &2157681100 !ruby/object:Gem::Requirement
         
     | 
| 
       62 
73 
     | 
    
         
             
                none: false
         
     | 
| 
       63 
74 
     | 
    
         
             
                requirements:
         
     | 
| 
       64 
75 
     | 
    
         
             
                - - ! '>='
         
     | 
| 
         @@ -66,7 +77,7 @@ dependencies: 
     | 
|
| 
       66 
77 
     | 
    
         
             
                    version: '0'
         
     | 
| 
       67 
78 
     | 
    
         
             
              type: :development
         
     | 
| 
       68 
79 
     | 
    
         
             
              prerelease: false
         
     | 
| 
       69 
     | 
    
         
            -
              version_requirements: * 
     | 
| 
      
 80 
     | 
    
         
            +
              version_requirements: *2157681100
         
     | 
| 
       70 
81 
     | 
    
         
             
            description: PanoramioRb gem help you to get geolocated photos from Panoramio.com
         
     | 
| 
       71 
82 
     | 
    
         
             
              how a Ruby Object.
         
     | 
| 
       72 
83 
     | 
    
         
             
            email:
         
     | 
| 
         @@ -128,7 +139,7 @@ required_ruby_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       128 
139 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       129 
140 
     | 
    
         
             
                  segments:
         
     | 
| 
       130 
141 
     | 
    
         
             
                  - 0
         
     | 
| 
       131 
     | 
    
         
            -
                  hash:  
     | 
| 
      
 142 
     | 
    
         
            +
                  hash: 473331433894629392
         
     | 
| 
       132 
143 
     | 
    
         
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         
     | 
| 
       133 
144 
     | 
    
         
             
              none: false
         
     | 
| 
       134 
145 
     | 
    
         
             
              requirements:
         
     | 
| 
         @@ -137,7 +148,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       137 
148 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       138 
149 
     | 
    
         
             
                  segments:
         
     | 
| 
       139 
150 
     | 
    
         
             
                  - 0
         
     | 
| 
       140 
     | 
    
         
            -
                  hash:  
     | 
| 
      
 151 
     | 
    
         
            +
                  hash: 473331433894629392
         
     | 
| 
       141 
152 
     | 
    
         
             
            requirements: []
         
     | 
| 
       142 
153 
     | 
    
         
             
            rubyforge_project: 
         
     | 
| 
       143 
154 
     | 
    
         
             
            rubygems_version: 1.6.2
         
     |