Last active
August 29, 2015 14:04
-
-
Save maxlinc/6b2f9f64fd25d680971c to your computer and use it in GitHub Desktop.
URI template sample
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template = Addressable::Template.new 'http://open.mapquestapi.com/staticmap/v4/getmap{?key,size,zoom,center}' | |
template.expand key: 'foo', size: [200, 400], zoom: 5, center: [200, 9] | |
# => <Addressable::URI:0x3ffb7b824dd8 URI:http://open.mapquestapi.com/staticmap/v4/getmap?key=foo&size=200,400&zoom=5¢er=200,9> | |
template.expand size: [200, 400], center: [200, 9] | |
# => <Addressable::URI:0x3ffb7b801ce8 URI:http://open.mapquestapi.com/staticmap/v4/getmap?size=200,400¢er=200,9> | |
template.expand size: [200, 400] | |
# => <Addressable::URI:0x3ffb7a1d3714 URI:http://open.mapquestapi.com/staticmap/v4/getmap?size=200,400> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template = Addressable::Template.new 'http://open.mapquestapi.com/staticmap/v4/getmap{?key}&size={size_x,size_y}{&zoom}¢er={center_x,center_y}' | |
# => <Addressable::Template:0x3ffb7b461174 PATTERN:http://open.mapquestapi.com/staticmap/v4/getmap{?key}&size={size_x,size_y}{&zoom}¢er={center_x,center_y}> | |
template.expand key: 'foo', size_x: 200, size_y: 400, zoom: 5, center_x: 200, center_y: 9 | |
# => <Addressable::URI:0x3ffb7a1cf920 URI:http://open.mapquestapi.com/staticmap/v4/getmap?key=foo&size=200,400&zoom=5¢er=200,9> | |
template.expand size_x: 200, size_y: 400, center_x: 200, center_y: 9 | |
# => <Addressable::URI:0x3ffb7a1e2340 URI:http://open.mapquestapi.com/staticmap/v4/getmap&size=200,400¢er=200,9> | |
template.expand size_x: 200, size_y: 400 | |
# => <Addressable::URI:0x3ffb7b8019c8 URI:http://open.mapquestapi.com/staticmap/v4/getmap&size=200,400¢er=> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment