Class: MySociety::MapIt::LocalAuthority
- Inherits:
-
Object
- Object
- MySociety::MapIt::LocalAuthority
- Defined in:
- lib/my_society/map_it.rb
Class Method Summary collapse
Instance Method Summary collapse
- #gss ⇒ Object
- #id ⇒ Object
-
#initialize(attributes) ⇒ LocalAuthority
constructor
A new instance of LocalAuthority.
- #name ⇒ Object
- #snac ⇒ Object
- #uri ⇒ Object
Constructor Details
#initialize(attributes) ⇒ LocalAuthority
Returns a new instance of LocalAuthority.
111 112 113 |
# File 'lib/my_society/map_it.rb', line 111 def initialize attributes self.attributes = attributes end |
Class Method Details
.find(uri) ⇒ Object
105 106 107 108 109 |
# File 'lib/my_society/map_it.rb', line 105 def self.find uri u = URI.parse uri r = Net::HTTP.get_response u new JSON.parse r.body end |
Instance Method Details
#gss ⇒ Object
127 128 129 |
# File 'lib/my_society/map_it.rb', line 127 def gss attributes['codes']['gss'] rescue nil end |
#id ⇒ Object
119 120 121 |
# File 'lib/my_society/map_it.rb', line 119 def id attributes['id'] end |
#name ⇒ Object
115 116 117 |
# File 'lib/my_society/map_it.rb', line 115 def name attributes['name'] end |
#snac ⇒ Object
123 124 125 |
# File 'lib/my_society/map_it.rb', line 123 def snac attributes['codes']['ons'] rescue nil end |
#uri ⇒ Object
131 132 133 |
# File 'lib/my_society/map_it.rb', line 131 def uri [ MySociety::MapIt.base_url, 'area', id ].join '/' end |