rcap 0.4 → 1.0.0.rc.1

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.
Files changed (63) hide show
  1. data/.gitignore +7 -0
  2. data/CHANGELOG.rdoc +6 -0
  3. data/Gemfile +4 -0
  4. data/README.rdoc +104 -85
  5. data/Rakefile +35 -0
  6. data/lib/rcap.rb +21 -14
  7. data/lib/rcap/alert.rb +26 -325
  8. data/lib/rcap/cap_1_1/alert.rb +363 -0
  9. data/lib/rcap/cap_1_1/area.rb +180 -0
  10. data/lib/rcap/cap_1_1/circle.rb +81 -0
  11. data/lib/rcap/cap_1_1/event_code.rb +22 -0
  12. data/lib/rcap/cap_1_1/geocode.rb +22 -0
  13. data/lib/rcap/cap_1_1/info.rb +470 -0
  14. data/lib/rcap/cap_1_1/parameter.rb +68 -0
  15. data/lib/rcap/cap_1_1/point.rb +55 -0
  16. data/lib/rcap/cap_1_1/polygon.rb +89 -0
  17. data/lib/rcap/cap_1_1/resource.rb +145 -0
  18. data/lib/rcap/cap_1_2/alert.rb +363 -0
  19. data/lib/rcap/cap_1_2/area.rb +180 -0
  20. data/lib/rcap/cap_1_2/circle.rb +81 -0
  21. data/lib/rcap/cap_1_2/event_code.rb +22 -0
  22. data/lib/rcap/cap_1_2/geocode.rb +22 -0
  23. data/lib/rcap/cap_1_2/info.rb +472 -0
  24. data/lib/rcap/cap_1_2/parameter.rb +68 -0
  25. data/lib/rcap/cap_1_2/point.rb +55 -0
  26. data/lib/rcap/cap_1_2/polygon.rb +90 -0
  27. data/lib/rcap/cap_1_2/resource.rb +147 -0
  28. data/lib/rcap/utilities.rb +14 -9
  29. data/lib/rcap/validations.rb +39 -7
  30. data/lib/rcap/version.rb +3 -0
  31. data/rcap.gemspec +30 -0
  32. data/spec/alert_spec.rb +109 -172
  33. data/spec/cap_1_1/alert_spec.rb +222 -0
  34. data/spec/cap_1_1/area_spec.rb +247 -0
  35. data/spec/cap_1_1/circle_spec.rb +88 -0
  36. data/spec/{geocode_spec.rb → cap_1_1/geocode_spec.rb} +8 -8
  37. data/spec/{info_spec.rb → cap_1_1/info_spec.rb} +143 -75
  38. data/spec/{point_spec.rb → cap_1_1/point_spec.rb} +8 -8
  39. data/spec/cap_1_1/polygon_spec.rb +97 -0
  40. data/spec/{resource_spec.rb → cap_1_1/resource_spec.rb} +24 -24
  41. data/spec/cap_1_2/alert_spec.rb +233 -0
  42. data/spec/cap_1_2/area_spec.rb +248 -0
  43. data/spec/cap_1_2/circle_spec.rb +95 -0
  44. data/spec/cap_1_2/geocode_spec.rb +38 -0
  45. data/spec/cap_1_2/info_spec.rb +338 -0
  46. data/spec/cap_1_2/point_spec.rb +46 -0
  47. data/spec/cap_1_2/polygon_spec.rb +102 -0
  48. data/spec/cap_1_2/resource_spec.rb +161 -0
  49. data/spec/spec.opts +2 -0
  50. data/spec/validations_spec.rb +80 -7
  51. metadata +122 -37
  52. data/lib/rcap/area.rb +0 -156
  53. data/lib/rcap/circle.rb +0 -78
  54. data/lib/rcap/event_code.rb +0 -20
  55. data/lib/rcap/geocode.rb +0 -20
  56. data/lib/rcap/info.rb +0 -437
  57. data/lib/rcap/parameter.rb +0 -66
  58. data/lib/rcap/point.rb +0 -53
  59. data/lib/rcap/polygon.rb +0 -77
  60. data/lib/rcap/resource.rb +0 -143
  61. data/spec/area_spec.rb +0 -179
  62. data/spec/circle_spec.rb +0 -88
  63. data/spec/polygon_spec.rb +0 -68
metadata CHANGED
@@ -1,11 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rcap
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
4
+ prerelease: true
5
5
  segments:
6
+ - 1
7
+ - 0
6
8
  - 0
7
- - 4
8
- version: "0.4"
9
+ - rc
10
+ - 1
11
+ version: 1.0.0.rc.1
9
12
  platform: ruby
10
13
  authors:
11
14
  - Farrel Lifson
@@ -13,7 +16,7 @@ autorequire:
13
16
  bindir: bin
14
17
  cert_chain: []
15
18
 
16
- date: 2011-03-06 00:00:00 +02:00
19
+ date: 2011-04-03 00:00:00 +02:00
17
20
  default_executable:
18
21
  dependencies:
19
22
  - !ruby/object:Gem::Dependency
@@ -25,7 +28,9 @@ dependencies:
25
28
  - !ruby/object:Gem::Version
26
29
  segments:
27
30
  - 0
28
- version: "0"
31
+ - 1
32
+ - 5
33
+ version: 0.1.5
29
34
  type: :runtime
30
35
  version_requirements: *id001
31
36
  - !ruby/object:Gem::Dependency
@@ -36,8 +41,10 @@ dependencies:
36
41
  - - ">="
37
42
  - !ruby/object:Gem::Version
38
43
  segments:
39
- - 0
40
- version: "0"
44
+ - 1
45
+ - 5
46
+ - 1
47
+ version: 1.5.1
41
48
  type: :runtime
42
49
  version_requirements: *id002
43
50
  - !ruby/object:Gem::Dependency
@@ -49,13 +56,42 @@ dependencies:
49
56
  - !ruby/object:Gem::Version
50
57
  segments:
51
58
  - 2
52
- - 0
53
- - 0
54
- version: 2.0.0
59
+ - 1
60
+ - 2
61
+ version: 2.1.2
55
62
  type: :runtime
56
63
  version_requirements: *id003
57
- description: A Ruby API providing parsing and generation of CAP(Common Alerting Protocol) messages.
58
- email: farrel.lifson@aimred.com
64
+ - !ruby/object:Gem::Dependency
65
+ name: rspec
66
+ prerelease: false
67
+ requirement: &id004 !ruby/object:Gem::Requirement
68
+ requirements:
69
+ - - ">="
70
+ - !ruby/object:Gem::Version
71
+ segments:
72
+ - 2
73
+ - 5
74
+ - 0
75
+ version: 2.5.0
76
+ type: :development
77
+ version_requirements: *id004
78
+ - !ruby/object:Gem::Dependency
79
+ name: hanna
80
+ prerelease: false
81
+ requirement: &id005 !ruby/object:Gem::Requirement
82
+ requirements:
83
+ - - ">="
84
+ - !ruby/object:Gem::Version
85
+ segments:
86
+ - 0
87
+ - 1
88
+ - 12
89
+ version: 0.1.12
90
+ type: :development
91
+ version_requirements: *id005
92
+ description: A Ruby API providing parsing, generation and validation of CAP(Common Alerting Protocol) messages.
93
+ email:
94
+ - farrel.lifson@aimred.com
59
95
  executables: []
60
96
 
61
97
  extensions: []
@@ -64,21 +100,58 @@ extra_rdoc_files:
64
100
  - README.rdoc
65
101
  - CHANGELOG.rdoc
66
102
  files:
103
+ - .gitignore
104
+ - CHANGELOG.rdoc
105
+ - Gemfile
106
+ - README.rdoc
107
+ - Rakefile
67
108
  - lib/rcap.rb
68
- - lib/rcap/area.rb
69
- - lib/rcap/polygon.rb
70
- - lib/rcap/resource.rb
71
- - lib/rcap/utilities.rb
72
- - lib/rcap/circle.rb
73
- - lib/rcap/point.rb
74
109
  - lib/rcap/alert.rb
75
- - lib/rcap/geocode.rb
110
+ - lib/rcap/cap_1_1/alert.rb
111
+ - lib/rcap/cap_1_1/area.rb
112
+ - lib/rcap/cap_1_1/circle.rb
113
+ - lib/rcap/cap_1_1/event_code.rb
114
+ - lib/rcap/cap_1_1/geocode.rb
115
+ - lib/rcap/cap_1_1/info.rb
116
+ - lib/rcap/cap_1_1/parameter.rb
117
+ - lib/rcap/cap_1_1/point.rb
118
+ - lib/rcap/cap_1_1/polygon.rb
119
+ - lib/rcap/cap_1_1/resource.rb
120
+ - lib/rcap/cap_1_2/alert.rb
121
+ - lib/rcap/cap_1_2/area.rb
122
+ - lib/rcap/cap_1_2/circle.rb
123
+ - lib/rcap/cap_1_2/event_code.rb
124
+ - lib/rcap/cap_1_2/geocode.rb
125
+ - lib/rcap/cap_1_2/info.rb
126
+ - lib/rcap/cap_1_2/parameter.rb
127
+ - lib/rcap/cap_1_2/point.rb
128
+ - lib/rcap/cap_1_2/polygon.rb
129
+ - lib/rcap/cap_1_2/resource.rb
130
+ - lib/rcap/utilities.rb
76
131
  - lib/rcap/validations.rb
77
- - lib/rcap/parameter.rb
78
- - lib/rcap/event_code.rb
79
- - lib/rcap/info.rb
80
- - README.rdoc
81
- - CHANGELOG.rdoc
132
+ - lib/rcap/version.rb
133
+ - rcap.gemspec
134
+ - spec/alert_spec.rb
135
+ - spec/cap_1_1/alert_spec.rb
136
+ - spec/cap_1_1/area_spec.rb
137
+ - spec/cap_1_1/circle_spec.rb
138
+ - spec/cap_1_1/geocode_spec.rb
139
+ - spec/cap_1_1/info_spec.rb
140
+ - spec/cap_1_1/point_spec.rb
141
+ - spec/cap_1_1/polygon_spec.rb
142
+ - spec/cap_1_1/resource_spec.rb
143
+ - spec/cap_1_2/alert_spec.rb
144
+ - spec/cap_1_2/area_spec.rb
145
+ - spec/cap_1_2/circle_spec.rb
146
+ - spec/cap_1_2/geocode_spec.rb
147
+ - spec/cap_1_2/info_spec.rb
148
+ - spec/cap_1_2/point_spec.rb
149
+ - spec/cap_1_2/polygon_spec.rb
150
+ - spec/cap_1_2/resource_spec.rb
151
+ - spec/spec.opts
152
+ - spec/spec_helper.rb
153
+ - spec/utilities_spec.rb
154
+ - spec/validations_spec.rb
82
155
  has_rdoc: true
83
156
  homepage: http://www.aimred.com/projects/rcap
84
157
  licenses: []
@@ -97,27 +170,39 @@ required_ruby_version: !ruby/object:Gem::Requirement
97
170
  version: "0"
98
171
  required_rubygems_version: !ruby/object:Gem::Requirement
99
172
  requirements:
100
- - - ">="
173
+ - - ">"
101
174
  - !ruby/object:Gem::Version
102
175
  segments:
103
- - 0
104
- version: "0"
176
+ - 1
177
+ - 3
178
+ - 1
179
+ version: 1.3.1
105
180
  requirements: []
106
181
 
107
- rubyforge_project:
182
+ rubyforge_project: rcap
108
183
  rubygems_version: 1.3.7
109
184
  signing_key:
110
185
  specification_version: 3
111
186
  summary: CAP(Common Alerting Protocol) API
112
187
  test_files:
113
- - spec/area_spec.rb
114
- - spec/resource_spec.rb
115
- - spec/polygon_spec.rb
116
- - spec/info_spec.rb
117
- - spec/circle_spec.rb
118
- - spec/geocode_spec.rb
119
- - spec/utilities_spec.rb
120
188
  - spec/alert_spec.rb
121
- - spec/validations_spec.rb
189
+ - spec/cap_1_1/alert_spec.rb
190
+ - spec/cap_1_1/area_spec.rb
191
+ - spec/cap_1_1/circle_spec.rb
192
+ - spec/cap_1_1/geocode_spec.rb
193
+ - spec/cap_1_1/info_spec.rb
194
+ - spec/cap_1_1/point_spec.rb
195
+ - spec/cap_1_1/polygon_spec.rb
196
+ - spec/cap_1_1/resource_spec.rb
197
+ - spec/cap_1_2/alert_spec.rb
198
+ - spec/cap_1_2/area_spec.rb
199
+ - spec/cap_1_2/circle_spec.rb
200
+ - spec/cap_1_2/geocode_spec.rb
201
+ - spec/cap_1_2/info_spec.rb
202
+ - spec/cap_1_2/point_spec.rb
203
+ - spec/cap_1_2/polygon_spec.rb
204
+ - spec/cap_1_2/resource_spec.rb
205
+ - spec/spec.opts
122
206
  - spec/spec_helper.rb
123
- - spec/point_spec.rb
207
+ - spec/utilities_spec.rb
208
+ - spec/validations_spec.rb
data/lib/rcap/area.rb DELETED
@@ -1,156 +0,0 @@
1
- module RCAP
2
- # An Area object is valid if
3
- # * it has an area description
4
- # * all Circle objects contained in circles are valid
5
- # * all Geocode objects contained in geocodes are valid
6
- # * all Polygon objects contained in polygons are valid
7
- # * altitude has a value if ceiling is set
8
- class Area
9
- include Validation
10
-
11
- # Area Description - Textual description of area.
12
- attr_accessor( :area_desc )
13
- # Expressed in feet above sea level
14
- attr_accessor( :altitude )
15
- # Expressed in feet above sea level.
16
- attr_accessor( :ceiling )
17
- # Collection of Circle objects
18
- attr_reader( :circles )
19
- # Collection of Geocode objects
20
- attr_reader( :geocodes )
21
- # Collection of Polygon objects
22
- attr_reader( :polygons )
23
-
24
- validates_presence_of( :area_desc )
25
- validates_collection_of( :circles, :geocodes, :polygons )
26
- validates_dependency_of( :ceiling, :on => :altitude )
27
-
28
- XML_ELEMENT_NAME = 'area' # :nodoc:
29
- AREA_DESC_ELEMENT_NAME = 'areaDesc' # :nodoc:
30
- ALTITUDE_ELEMENT_NAME = 'altitude' # :nodoc:
31
- CEILING_ELEMENT_NAME = 'ceiling' # :nodoc:
32
-
33
- XPATH = "cap:#{ XML_ELEMENT_NAME }" # :nodoc:
34
- AREA_DESC_XPATH = "cap:#{ AREA_DESC_ELEMENT_NAME }" # :nodoc:
35
- ALTITUDE_XPATH = "cap:#{ ALTITUDE_ELEMENT_NAME }" # :nodoc:
36
- CEILING_XPATH = "cap:#{ CEILING_ELEMENT_NAME }" # :nodoc:
37
-
38
- def initialize( attributes = {})
39
- @area_desc = attributes[ :area_desc ]
40
- @altitude = attributes[ :altitude ]
41
- @ceiling = attributes[ :ceiling ]
42
- @circles = Array( attributes[ :circles ])
43
- @geocodes = Array( attributes[ :geocodes ])
44
- @polygons = Array( attributes[ :polygons ])
45
- end
46
-
47
- def to_xml_element # :nodoc:
48
- xml_element = REXML::Element.new( XML_ELEMENT_NAME )
49
- xml_element.add_element( AREA_DESC_ELEMENT_NAME ).add_text( @area_desc.to_s )
50
- add_to_xml_element = lambda do |element, object|
51
- element.add_element( object.to_xml_element )
52
- element
53
- end
54
- @polygons.inject( xml_element, &add_to_xml_element )
55
- @circles.inject( xml_element, &add_to_xml_element )
56
- @geocodes.inject( xml_element, &add_to_xml_element )
57
- xml_element.add_element( ALTITUDE_ELEMENT_NAME ).add_text( @altitude.to_s ) unless self.altitude.blank?
58
- xml_element.add_element( CEILING_ELEMENT_NAME ).add_text( @ceiling.to_s ) unless self.altitude.blank?
59
- xml_element
60
- end
61
-
62
- def to_xml # :nodoc:
63
- self.to_xml_element.to_s
64
- end
65
-
66
- # Implements an equality operator for the Area object. Two Area objects are equal if all their attributes are equal.
67
- def ==( other )
68
- comparison_attributes = lambda{ |area| [ area.area_desc, area.altitude, area.ceiling, area.circles, area.geocodes, area.polygons ]}
69
- comparison_attributes.call( self ) == comparison_attributes.call( other )
70
- end
71
-
72
- def inspect # :nodoc:
73
- area_inspect = <<EOF
74
- Area Description: #{ self.area_desc }
75
- Polygons:
76
- #{ self.polygons.map{ |polygon| " " + polygon.inspect }.join("\n" )}
77
- Circles: #{ self.circles.inspect }
78
- Geocodes: #{ self.geocodes.inspect }
79
- EOF
80
- RCAP.format_lines_for_inspect( 'AREA', area_inspect )
81
- end
82
-
83
- # Returns a string representation of the area of the form
84
- # area_desc
85
- def to_s
86
- self.area_desc
87
- end
88
-
89
- def self.from_xml_element( area_xml_element ) # :nodoc:
90
- RCAP::Area.new( :area_desc => RCAP.xpath_text( area_xml_element, AREA_DESC_XPATH ),
91
- :altitude => (( alt = RCAP.xpath_text( area_xml_element, ALTITUDE_XPATH )) ? alt.to_f : nil ),
92
- :ceiling => (( ceil = RCAP.xpath_text( area_xml_element, CEILING_XPATH )) ? ceil.to_f : nil ),
93
- :circles => RCAP.xpath_match( area_xml_element, RCAP::Circle::XPATH ).map{ |circle_element| RCAP::Circle.from_xml_element( circle_element )},
94
- :geocodes => RCAP.xpath_match( area_xml_element, RCAP::Geocode::XPATH ).map{ |geocode_element| RCAP::Geocode.from_xml_element( geocode_element )},
95
- :polygons => RCAP.xpath_match( area_xml_element, RCAP::Polygon::XPATH ).map{ |polygon_element| RCAP::Polygon.from_xml_element( polygon_element )})
96
- end
97
-
98
- AREA_DESC_YAML = 'Area Description' # :nodoc:
99
- ALTITUDE_YAML = 'Altitude' # :nodoc:
100
- CEILING_YAML = 'Ceiling' # :nodoc:
101
- CIRCLES_YAML = 'Circles' # :nodoc:
102
- GEOCODES_YAML = 'Geocodes' # :nodoc:
103
- POLYGONS_YAML = 'Polygons' # :nodoc:
104
-
105
- def to_yaml( options = {} ) # :nodoc:
106
- circles_yaml = self.circles.map{ |circle| [ circle.lattitude, circle.longitude, circle.radius ]}
107
- def circles_yaml.to_yaml_style; :inline; end
108
-
109
- RCAP.attribute_values_to_hash(
110
- [ AREA_DESC_YAML, self.area_desc ],
111
- [ ALTITUDE_YAML, self.altitude ],
112
- [ CEILING_YAML, self.ceiling ],
113
- [ CIRCLES_YAML, circles_yaml ],
114
- [ GEOCODES_YAML, self.geocodes.inject({}){|h,geocode| h.merge( geocode.name => geocode.value )}],
115
- [ POLYGONS_YAML, self.polygons ]
116
- ).to_yaml( options )
117
- end
118
-
119
- def from_yaml_data( area_yaml_data ) # :nodoc:
120
- Area.new(
121
- :area_desc => area_yaml_data[ AREA_DESC_YAML ],
122
- :altitude => area_yaml_data[ ALTITUDE_YAML ],
123
- :ceiling => area_yaml_data[ CEILING_YAML ],
124
- :circles => Array( area_yaml_data[ CIRCLES_YAML ]).map{ |circle_yaml_data| RCAP::Circle.from_yaml_data( circle_yaml_data )},
125
- :geocodes => Array( area_yaml_data[ GEOCODES_YAML ]).map{ |name, value| RCAP::Geocode.new( :name => name, :value => value )},
126
- :polygons => Array( area_yaml_data[ POLYGONS_YAML ]).map{ |polyon_yaml_data| RCAP::Polygon.from_yaml_data( polyon_yaml_data )}
127
- )
128
- end
129
-
130
- AREA_DESC_KEY = 'area_desc' # :nodoc:
131
- ALTITUDE_KEY = 'altitude' # :nodoc:
132
- CEILING_KEY = 'ceiling' # :nodoc:
133
- CIRCLES_KEY = 'circles' # :nodoc:
134
- GEOCODES_KEY = 'geocodes' # :nodoc:
135
- POLYGONS_KEY = 'polygons' # :nodoc:
136
-
137
- def to_h # :nodoc:
138
- { AREA_DESC_KEY => self.area_desc,
139
- ALTITUDE_KEY => self.altitude,
140
- CEILING_KEY => self.ceiling,
141
- CIRCLES_KEY => self.circles.map{ |circle| circle.to_h },
142
- GEOCODES_KEY => self.geocodes.map{ |geocode| geocode.to_h },
143
- POLYGONS_KEY => self.polygons.map{ |polygon| polygon.to_h }}
144
- end
145
-
146
- def self.from_h( area_hash ) # :nodoc:
147
- self.new(
148
- :area_desc => area_hash[ AREA_DESC_KEY ],
149
- :altitude => area_hash[ ALTITUDE_KEY ],
150
- :ceiling => area_hash[ CEILING_KEY ],
151
- :circles => area_hash[ CIRCLES_KEY ].map{ |circle_hash| RCAP::Circle.from_h( circle_hash )},
152
- :geocodes => area_hash[ GEOCODES_KEY ].map{ |geocode_hash| RCAP::Geocode.from_h( geocode_hash )},
153
- :polygons => area_hash[ POLYGONS_KEY ].map{ |polygon_hash| RCAP::Polygon.from_h( polygon_hash )})
154
- end
155
- end
156
- end
data/lib/rcap/circle.rb DELETED
@@ -1,78 +0,0 @@
1
- module RCAP
2
- # A Circle object is valid if
3
- # * it has a valid lattitude and longitude
4
- # * it has a radius with a value greater than zero
5
- class Circle < Point
6
- include Validation
7
-
8
- # Expresed in kilometers
9
- attr_accessor( :radius )
10
-
11
- validates_presence_of( :radius )
12
- validates_numericality_of( :radius , :greater_than => 0 )
13
-
14
- XML_ELEMENT_NAME = 'circle' # :nodoc:
15
-
16
- XPATH = 'cap:circle' # :nodoc:
17
-
18
- def initialize( attributes = {} )
19
- super( attributes )
20
- @radius = attributes[ :radius ]
21
- end
22
-
23
- # Returns a string representation of the circle of the form
24
- # lattitude,longitude,radius
25
- def to_s # :nodoc:
26
- "#{ self.lattitude },#{ self.longitude },#{ self.radius }"
27
- end
28
-
29
- def inspect # :nodoc:
30
- "(#{ self.lattitude},#{ self.longitude },#{ self.radius })"
31
- end
32
-
33
- def to_xml_element # :nodoc:
34
- xml_element = REXML::Element.new( XML_ELEMENT_NAME )
35
- xml_element.add_text( self.to_s )
36
- xml_element
37
- end
38
-
39
- def to_xml # :nodoc:
40
- self.to_xml_element.to_s
41
- end
42
-
43
- def self.parse_circle_string( circle_string ) # :nodoc:
44
- lattitude, longitude, radius = circle_string.split( ',' )
45
- [ lattitude, longitude, radius ].map{ |e| e.to_f }
46
- end
47
-
48
- def self.from_xml_element( circle_xml_element ) # :nodoc:
49
- lattitude, longitude, radius = self.parse_circle_string( circle_xml_element.text )
50
- circle = self.new( :lattitude => lattitude,
51
- :longitude => longitude,
52
- :radius => radius )
53
- end
54
-
55
- # Two circles are equivalent if their lattitude, longitude and radius are equal.
56
- def ==( other )
57
- [ self.lattitude, self.longitude, self.radius ] == [ other.lattitude, other.longitude, other.radius ]
58
- end
59
-
60
- def self.from_yaml_data( circle_yaml_data ) # :nodoc:
61
- lattitude, longitude,radius = circle_yaml_data
62
- self.new( :lattitude => lattitude, :longitude => longitude, :radius => radius )
63
- end
64
-
65
- RADIUS_KEY = 'radius' # :nodoc:
66
- LATTITUDE_KEY = 'lattitude' # :nodoc:
67
- LONGITUDE_KEY = 'longitude' # :nodoc:
68
- def to_h # :nodoc:
69
- RCAP.attribute_values_to_hash( [ RADIUS_KEY, self.radius ],
70
- [ LATTITUDE_KEY, self.lattitude ],
71
- [ LONGITUDE_KEY, self.longitude ])
72
- end
73
-
74
- def self.from_h( circle_hash ) # :nodoc:
75
- self.new( :radius => circle_hash[ RADIUS_KEY ], :lattitude => circle_hash[ LATTITUDE_KEY ], :longitude => circle_hash[ LONGITUDE_KEY ])
76
- end
77
- end
78
- end