rosemary 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- YzdiYjdiYmEzMmE1NjgyYTFmODVjN2NmYTMyODVmNTJkMmZiMWQ5OA==
4
+ NDI3NDY3ZWM5MTI0MTE3OTgzYTE2MWNlMWU2MTM1YWNiNjBiNDY3ZA==
5
5
  data.tar.gz: !binary |-
6
- MDRhZTU1MzNiOWVhNzJjYzk3NWFkMjYxYWM2NGVlOGQ1NjFmMTg0ZQ==
6
+ ZWQyNmNlMWVmZTdjYmIyNDE0NmRhZmQ2ZGU5MjJhZDdhNDQwYTA2Yg==
7
7
  !binary "U0hBNTEy":
8
8
  metadata.gz: !binary |-
9
- ZDc4MzgwYjBlZjE4YjBiMjQ3YWQ1NDlkYjgyYjVmN2ZiMTI1MTc4OWFjZmE2
10
- N2FiZmZiYmQxZmIyODQ2NWEwYWY5ZjVlYWNkYWEzOWExOGIwNWM2NDI3ODQw
11
- Mjk0YjMxZTNhZmE4NDZjZmZlMWU3Y2ZlMjJhNThhZjI1YzIyNmM=
9
+ OTkxZjI5NjY3NzhkZGM1ZTM5NzhlYjJmYzFjZDhjNzkwZDgyNWIzYTY5ZTA1
10
+ ZTVhMjNjNTU3ZjMwYWNiZjY2MjczNjhkMmUzYWY2YzdmYWUwNzU5OTA3MjY1
11
+ YTZkYzhkMTkwZjRjZmMzZjJlZjc5YWVmMjQ0YzM3ZTllZDBmMjE=
12
12
  data.tar.gz: !binary |-
13
- M2E2ZWY2MmI3ZmY4ZmZiOWNlNjI0YjhiNTE4M2Y3YTZkOWYzZjMxMjhmODFj
14
- YzU1ODUxZmYyMWU5ZDlkNGM0NDY4NjllYTk5YmIyMzAyOGRhNTg3YTE4MTY4
15
- NzAzZjQ5OGJkMTFiZjQ0MzI0ZGE1M2MwYmRlZjc4NDE4NTZiNTg=
13
+ MzBkZTViYTBkNjVlNzdmNzQ1YTkyNDdiMjNlNTgxNzU0YzM5Y2Q4OTk2Nzk4
14
+ ZDgwMjA5OTUwZDI2ZmNlOTUxNmU3NzI4ZWM1Y2FhNzBhOTFlZGY3M2Q0OWVi
15
+ NjQ1Mjg4ZTVjZDdhNTliZTk0MDZiYzAwMjlmZTg3OGFjMTI5YzY=
data/CHANGELOG.md ADDED
@@ -0,0 +1,19 @@
1
+ rosemary CHANGELOG
2
+ ===================================
3
+ This file is used to list changes made in each version.
4
+
5
+
6
+ v0.4.1 (2014 May 27)
7
+ ------
8
+
9
+ * Fix: Return value of notes API call (thanks github.com/alexandrz)
10
+
11
+ v0.4.0 (2014 April 23)
12
+ ------
13
+
14
+ * Add support for the notes API call. (thanks github.com/alexandrz)
15
+
16
+ v0.1.0
17
+ ------
18
+
19
+ * First version
data/lib/rosemary/note.rb CHANGED
@@ -8,12 +8,16 @@ module Rosemary
8
8
  attr_accessor :lat
9
9
  attr_accessor :lon
10
10
  attr_accessor :text
11
+ attr_accessor :user
12
+ attr_accessor :action
11
13
 
12
14
  def initialize(attrs = {})
13
15
  attrs.stringify_keys!
14
16
  @lat = attrs['lat']
15
17
  @lon = attrs['lon']
16
18
  @text = attrs['text'] || ''
19
+ @user = attrs['user']
20
+ @action = attrs['action'] || ''
17
21
  end
18
22
 
19
23
  end
@@ -43,23 +43,34 @@ class Rosemary::Parser < HTTParty::Parser
43
43
  end
44
44
 
45
45
  def on_start_element(name, attr_hash) # :nodoc:
46
- case name
47
- when 'node' then _start_node(attr_hash)
48
- when 'way' then _start_way(attr_hash)
49
- when 'relation' then _start_relation(attr_hash)
50
- when 'changeset' then _start_changeset(attr_hash)
51
- when 'user' then _start_user(attr_hash)
52
- when 'tag' then _tag(attr_hash)
53
- when 'nd' then _nd(attr_hash)
54
- when 'member' then _member(attr_hash)
55
- when 'home' then _home(attr_hash)
56
- when 'description' then @description = true
57
- when 'permissions' then _start_permissions(attr_hash)
58
- when 'permission' then _start_permission(attr_hash)
59
- when 'lang' then @lang = true
60
- when 'note' then _start_note(attr_hash)
61
- when 'id' then @id = true
62
- when 'text' then @text = true
46
+ case @context.class.name
47
+ when 'Rosemary::User'
48
+ case name
49
+ when 'description' then @description = true
50
+ when 'lang' then @lang = true
51
+ end
52
+ when 'Rosemary::Note'
53
+ case name
54
+ when 'id' then @id = true
55
+ when 'text' then @text = true
56
+ when 'user' then @user = true
57
+ when 'action' then @action = true
58
+ end
59
+ else
60
+ case name
61
+ when 'node' then _start_node(attr_hash)
62
+ when 'way' then _start_way(attr_hash)
63
+ when 'relation' then _start_relation(attr_hash)
64
+ when 'changeset' then _start_changeset(attr_hash)
65
+ when 'user' then _start_user(attr_hash)
66
+ when 'tag' then _tag(attr_hash)
67
+ when 'nd' then _nd(attr_hash)
68
+ when 'member' then _member(attr_hash)
69
+ when 'home' then _home(attr_hash)
70
+ when 'permissions' then _start_permissions(attr_hash)
71
+ when 'permission' then _start_permission(attr_hash)
72
+ when 'note' then _start_note(attr_hash)
73
+ end
63
74
  end
64
75
  end
65
76
 
@@ -69,26 +80,22 @@ class Rosemary::Parser < HTTParty::Parser
69
80
  when 'lang' then @lang = false
70
81
  when 'id' then @id = false
71
82
  when 'text' then @text = false
83
+ when 'action' then @action = false
84
+ when 'user' then @user = false
72
85
  when 'changeset' then _end_changeset
73
86
  end
74
87
  end
75
88
 
76
89
  def on_characters(chars)
77
- if @context.class.name == 'Rosemary::User'
78
- if @description
79
- @context.description = chars
80
- end
81
- if @lang
82
- @context.languages << chars
83
- end
84
- end
85
- if @context.class.name == 'Rosemary::Note'
86
- if @id
87
- @context.id = chars
88
- end
89
- if @text
90
- @context.text << chars
91
- end
90
+ case @context.class.name
91
+ when 'Rosemary::User'
92
+ @context.description = chars if @description
93
+ @context.languages << chars if @lang
94
+ when 'Rosemary::Note'
95
+ @context.id = chars if @id
96
+ @context.text << chars if @text
97
+ @context.user = chars if @user
98
+ @context.action = chars if @action
92
99
  end
93
100
  end
94
101
 
@@ -1,4 +1,4 @@
1
1
  module Rosemary
2
2
  # The current version of this gem.
3
- VERSION = "0.4.0"
3
+ VERSION = "0.4.1"
4
4
  end
data/rosemary.gemspec CHANGED
@@ -11,7 +11,7 @@ Gem::Specification.new do |s|
11
11
  s.date = Time.now
12
12
  s.description = "OpenStreetMap API client for ruby"
13
13
  s.email = ["info@christophbuente.de"]
14
- s.extra_rdoc_files = ["CHANGELOG", "LICENSE", "README.md"]
14
+ s.extra_rdoc_files = ["CHANGELOG.md", "LICENSE", "README.md"]
15
15
  s.homepage = "https://github.com/sozialhelden/rosemary"
16
16
  s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "OpenStreetMap", "--main", "README.md"]
17
17
  s.require_paths = ["lib"]
@@ -11,16 +11,19 @@ describe Note do
11
11
  def valid_fake_note
12
12
  note=<<-EOF
13
13
  <osm version="0.6" generator="OpenStreetMap server">
14
- <note lon="120.9283065" lat="15.0115916">
15
- <id>397</id>
16
- <url>http://api06.dev.openstreetmap.org/api/0.6/notes/397</url>
17
- <comment_url>http://api06.dev.openstreetmap.org/api/0.6/notes/397/comment</comment_url>
18
- <close_url>http://api06.dev.openstreetmap.org/api/0.6/notes/397/close</close_url>
19
- <date_created>2014-04-23 13:57:37 UTC</date_created>
14
+ <note lon="102.2205" lat="2.1059">
15
+ <id>174576</id>
16
+ <url>http://www.openstreetmap.org/api/0.6/notes/174576</url>
17
+ <comment_url>http://www.openstreetmap.org/api/0.6/notes/174576/comment</comment_url>
18
+ <close_url>http://www.openstreetmap.org/api/0.6/notes/174576/close</close_url>
19
+ <date_created>2014-05-26 16:00:04 UTC</date_created>
20
20
  <status>open</status>
21
21
  <comments>
22
22
  <comment>
23
- <date>2014-04-23 13:57:37 UTC</date>
23
+ <date>2014-05-26 16:00:04 UTC</date>
24
+ <uid>2044077</uid>
25
+ <user>osmthis</user>
26
+ <user_url>http://www.openstreetmap.org/user/osmthis</user_url>
24
27
  <action>opened</action>
25
28
  <text>Test note</text>
26
29
  <html>&lt;p&gt;Test note&lt;/p&gt;</html>
@@ -40,7 +43,7 @@ describe Note do
40
43
  describe '#create_note:' do
41
44
 
42
45
  def request_url
43
- "http://a_username:a_password@www.openstreetmap.org/api/0.6/notes?lat=15.0115916&lon=120.9283065&text=Test%20note"
46
+ "http://a_username:a_password@www.openstreetmap.org/api/0.6/notes?lat=2.1059&lon=102.2205&text=Test%20note"
44
47
  end
45
48
 
46
49
  def stubbed_request
@@ -48,7 +51,7 @@ describe Note do
48
51
  end
49
52
 
50
53
  def valid_note
51
- {lon: 120.9283065, lat: 15.0115916, text: 'Test note'}
54
+ {lon: 102.2205, lat: 2.1059, text: 'Test note'}
52
55
  end
53
56
 
54
57
  it "should create a new Note from given attributes" do
@@ -56,10 +59,12 @@ describe Note do
56
59
  to_return(:status => 200, :body => valid_fake_note, :headers => {'Content-Type' => 'application/xml'})
57
60
 
58
61
  new_note = osm.create_note(valid_note)
59
- new_note.id.should eql '397'
60
- new_note.lon.should eql '120.9283065'
61
- new_note.lat.should eql '15.0115916'
62
+ new_note.id.should eql '174576'
63
+ new_note.lon.should eql '102.2205'
64
+ new_note.lat.should eql '2.1059'
62
65
  new_note.text.should eql 'Test note'
66
+ new_note.user.should eql 'osmthis'
67
+ new_note.action.should eql 'opened'
63
68
  end
64
69
  end
65
70
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rosemary
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Christoph Bünte, Enno Brehm
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-04-23 00:00:00.000000000 Z
11
+ date: 2014-05-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -170,7 +170,7 @@ email:
170
170
  executables: []
171
171
  extensions: []
172
172
  extra_rdoc_files:
173
- - CHANGELOG
173
+ - CHANGELOG.md
174
174
  - LICENSE
175
175
  - README.md
176
176
  files:
@@ -179,7 +179,7 @@ files:
179
179
  - .ruby-version
180
180
  - .rvmrc
181
181
  - .travis.yml
182
- - CHANGELOG
182
+ - CHANGELOG.md
183
183
  - Gemfile
184
184
  - LICENSE
185
185
  - Manifest
data/CHANGELOG DELETED
@@ -1 +0,0 @@
1
- v0.1. First version