happymapper 0.4.1 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: c5f18b01260e792ddaddc9c9401dfc95768835e7
4
+ data.tar.gz: 591a0490cfc13b0df762d9b42402d49906eccf17
5
+ SHA512:
6
+ metadata.gz: 02bc2a6fb0cde9e96995059d5b5f866588a5a47124898016800cb46179b6c2a038429b01f54cfd2a0022bd647018cb0a548774d8342489b6b910f5c7396398bb
7
+ data.tar.gz: 604c778be7d6941336ac402d5cdab136f578e9b71e72a518f4a938a615a10e2e8c5be7cfceccd8735255ff6c8dd46f3e155d7b14ebc16ee9648da9e0f0db7cf4
@@ -1,3 +1,5 @@
1
+ NOTE: This project is no longer maintained. If you are interested in helping, let me know. There does seem to be a maintained fork (https://github.com/dam5s/happymapper).
2
+
1
3
  = happymapper
2
4
 
3
5
  == DESCRIPTION:
@@ -52,4 +54,4 @@ http://github.com/jnunemaker/happymapper/tree/master/examples/
52
54
 
53
55
  == DOCS:
54
56
 
55
- http://rdoc.info/projects/jnunemaker/happymapper
57
+ http://rdoc.info/projects/jnunemaker/happymapper
@@ -22,16 +22,16 @@ class Status
22
22
 
23
23
  element :id, Integer
24
24
  element :text, String
25
- element :created_at, Time
26
- element :source, String
27
- element :truncated, Boolean
28
- element :in_reply_to_status_id, Integer
29
- element :in_reply_to_user_id, Integer
30
- element :favorited, Boolean
31
- has_one :user, User
25
+ element :created_at, Time
26
+ element :source, String
27
+ element :truncated, Boolean
28
+ element :in_reply_to_status_id, Integer
29
+ element :in_reply_to_user_id, Integer
30
+ element :favorited, Boolean
31
+ has_one :user, User
32
32
  end
33
33
 
34
34
  statuses = Status.parse(file_contents)
35
35
  statuses.each do |status|
36
36
  puts status.user.name, status.user.screen_name, status.text, status.source, ''
37
- end
37
+ end
@@ -140,7 +140,7 @@ module HappyMapper
140
140
  # Create an xml representation of the specified class based on defined
141
141
  # HappyMapper elements and attributes. The method is defined in a way
142
142
  # that it can be called recursively by classes that are also HappyMapper
143
- # classes, allowg for the composition of classes.
143
+ # classes, allowing for the composition of classes.
144
144
  #
145
145
  def to_xml(parent_node = nil, default_namespace = nil)
146
146
 
@@ -214,7 +214,7 @@ module HappyMapper
214
214
  end
215
215
  end
216
216
 
217
- current_node[ "#{attribute_namespace ? "#{attribute_namespace.prefix}:" : ""}#{attribute.tag}" ] = value
217
+ current_node[ "#{attribute_namespace ? "#{attribute_namespace.prefix}:" : ""}#{attribute.tag}" ] = value.to_s
218
218
  end
219
219
 
220
220
  #
@@ -1,3 +1,3 @@
1
1
  module HappyMapper
2
- Version = '0.4.1'
2
+ Version = '0.5.0'
3
3
  end
@@ -8,6 +8,12 @@ module ToXML
8
8
  tag 'address'
9
9
 
10
10
  attribute :location, String
11
+ attribute :precipitation, Float
12
+ attribute :last_update, Time
13
+ attribute :mayor_elected, Date
14
+ attribute :last_earthquake, DateTime
15
+ attribute :revision, Integer
16
+ attribute :domestic, Boolean
11
17
 
12
18
  element :street, String
13
19
  element :postcode, String
@@ -82,7 +88,13 @@ module ToXML
82
88
  'postcode' => '98103',
83
89
  'city' => 'Seattle',
84
90
  'country' => Country.new(:name => 'USA', :code => 'us'),
85
- 'date_created' => '2011-01-01 15:00:00')
91
+ 'date_created' => '2011-01-01 15:00:00',
92
+ 'precipitation' => 58.3,
93
+ 'last_update' => Time.new(1993, 02, 24, 12, 0, 0, "+09:00"),
94
+ 'mayor_elected' => Date.new(2001, 2, 3) ,
95
+ 'last_earthquake' => DateTime.new(2001, -11, -26, -20, -55, -54, '+7'),
96
+ 'revision' => 42,
97
+ 'domestic' => true)
86
98
 
87
99
  address.dates_updated = ["2011-01-01 16:01:00","2011-01-02 11:30:01"]
88
100
 
@@ -103,10 +115,6 @@ module ToXML
103
115
  @address_xml.find("housenumber").first.child.to_s.should == "[1313]"
104
116
  end
105
117
 
106
- it "should have the attribute 'location' with the value 'Home'" do
107
- @address_xml.find('@location').first.child.to_s.should == "Home"
108
- end
109
-
110
118
  it "should add an empty description element" do
111
119
  @address_xml.find('description').first.child.to_s.should == ""
112
120
  end
@@ -130,9 +138,36 @@ module ToXML
130
138
  @address_xml.find('country/countryName').first.child.to_s.should == "USA"
131
139
  end
132
140
 
133
- end
141
+ it "should have the attribute 'location' with the value 'Home'" do
142
+ @address_xml.find('@location').first.child.to_s.should == 'Home'
143
+ end
144
+
145
+ it "should have the attribute 'precipitation' with the value '58.3'" do
146
+ @address_xml.find('@precipitation').first.child.to_s.should == '58.3'
147
+ end
148
+
149
+ it "should have the attribute 'last_update' with the value '1993-02-24 12:00:00 +0900'" do
150
+ @address_xml.find('@last_update').first.child.to_s.should == "1993-02-24 12:00:00 +0900"
151
+ end
134
152
 
153
+ it "should have the attribute 'mayor_elected' with the value '2001-02-03'" do
154
+ @address_xml.find('@mayor_elected').first.child.to_s.should == '2001-02-03'
155
+ end
156
+
157
+ it "should have the attribute 'last_earthquake' with the value ''" do
158
+ @address_xml.find('@last_earthquake').first.child.to_s.should == '2001-02-03T04:05:06+07:00'
159
+ end
160
+
161
+ it "should have the attribute 'revision' with the value '42'" do
162
+ @address_xml.find('@revision').first.child.to_s.should == '42'
163
+ end
164
+
165
+ it "should have the attribute 'domestic' with the value 'true'" do
166
+ @address_xml.find('@domestic').first.child.to_s.should == 'true'
167
+ end
168
+
169
+ end
135
170
 
136
171
  end
137
172
 
138
- end
173
+ end
metadata CHANGED
@@ -1,32 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: happymapper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
5
- prerelease:
4
+ version: 0.5.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - John Nunemaker
9
8
  autorequire:
10
9
  bindir: bin
11
10
  cert_chain: []
12
- date: 2013-09-26 00:00:00.000000000 Z
11
+ date: 2018-03-22 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: libxml-ruby
16
15
  requirement: !ruby/object:Gem::Requirement
17
- none: false
18
16
  requirements:
19
- - - ~>
17
+ - - "~>"
20
18
  - !ruby/object:Gem::Version
21
- version: '2.0'
19
+ version: '2.9'
22
20
  type: :runtime
23
21
  prerelease: false
24
22
  version_requirements: !ruby/object:Gem::Requirement
25
- none: false
26
23
  requirements:
27
- - - ~>
24
+ - - "~>"
28
25
  - !ruby/object:Gem::Version
29
- version: '2.0'
26
+ version: '2.9'
30
27
  description:
31
28
  email:
32
29
  - nunemaker@gmail.com
@@ -34,17 +31,20 @@ executables: []
34
31
  extensions: []
35
32
  extra_rdoc_files: []
36
33
  files:
34
+ - License
35
+ - README.rdoc
36
+ - Rakefile
37
37
  - examples/amazon.rb
38
38
  - examples/current_weather.rb
39
39
  - examples/dashed_elements.rb
40
40
  - examples/multi_street_address.rb
41
41
  - examples/post.rb
42
42
  - examples/twitter.rb
43
+ - lib/happymapper.rb
43
44
  - lib/happymapper/attribute.rb
44
45
  - lib/happymapper/element.rb
45
46
  - lib/happymapper/item.rb
46
47
  - lib/happymapper/version.rb
47
- - lib/happymapper.rb
48
48
  - spec/fixtures/address.xml
49
49
  - spec/fixtures/analytics.xml
50
50
  - spec/fixtures/commit.xml
@@ -71,37 +71,27 @@ files:
71
71
  - spec/spec.opts
72
72
  - spec/spec_helper.rb
73
73
  - spec/support/models.rb
74
- - License
75
- - Rakefile
76
- - README.rdoc
77
74
  homepage: http://happymapper.rubyforge.org
78
75
  licenses: []
76
+ metadata: {}
79
77
  post_install_message:
80
78
  rdoc_options: []
81
79
  require_paths:
82
80
  - lib
83
81
  required_ruby_version: !ruby/object:Gem::Requirement
84
- none: false
85
82
  requirements:
86
- - - ! '>='
83
+ - - ">="
87
84
  - !ruby/object:Gem::Version
88
85
  version: '0'
89
- segments:
90
- - 0
91
- hash: -3590435398206402919
92
86
  required_rubygems_version: !ruby/object:Gem::Requirement
93
- none: false
94
87
  requirements:
95
- - - ! '>='
88
+ - - ">="
96
89
  - !ruby/object:Gem::Version
97
90
  version: '0'
98
- segments:
99
- - 0
100
- hash: -3590435398206402919
101
91
  requirements: []
102
92
  rubyforge_project: happymapper
103
- rubygems_version: 1.8.23
93
+ rubygems_version: 2.6.14
104
94
  signing_key:
105
- specification_version: 3
95
+ specification_version: 4
106
96
  summary: object to xml mapping library
107
97
  test_files: []