gnip_gnop 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -20,6 +20,6 @@ module GnipGnop
20
20
  has_one :author, Author
21
21
  has_one :activity_author, ActivityAuthor
22
22
  has_one :activity_actor, ActivityActor
23
- has_one :matching_rule, MatchingRule
23
+ has_many :matching_rules, MatchingRule
24
24
  end
25
25
  end
@@ -2,10 +2,11 @@ module GnipGnop
2
2
  class MatchingRule
3
3
  include HappyMapper
4
4
 
5
- tag 'matching_rules'
5
+ tag 'matching_rule'
6
6
 
7
7
  namespace 'http://www.gnip.com/schemas/2010'
8
8
 
9
- element :rule, String, :tag => 'matching_rule'
9
+ attribute :rel, String
10
+ content :rule
10
11
  end
11
12
  end
@@ -1,3 +1,3 @@
1
1
  module GnipGnop
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -0,0 +1,47 @@
1
+ <entry xmlns:gnip="http://www.gnip.com/schemas/2010" xmlns="http://www.w3.org/2005/Atom">
2
+ <id>tag:search.twitter.com,2005:185095872315539457</id>
3
+ <published>2012-03-28T20:07:49Z</published>
4
+ <updated>2012-03-28T20:07:49Z</updated>
5
+ <title>AskLaLa (AskLaLa) posted a note on Twitter</title>
6
+ <summary type="html">new york Curbed SF has rounded up four of San Francisco's tiniest abodes, which range in size from 34... http://t.co/UkXbbti2 apartments</summary>
7
+ <category term="StatusPosted" label="Status Posted"/>
8
+ <category term="NotePosted" label="Note Posted"/>
9
+ <link rel="alternate" type="text/html" href="http://twitter.com/AskLaLa/statuses/185095872315539457"/>
10
+ <source>
11
+ <link rel="self" type="application/atom+xml" href="http://search.twitter.com/search.atom?q=apartments&amp;rpp=99&amp;result_type=recent&amp;since_id=185095872315539457"/>
12
+ <title>Twitter - Keyword - Notices - apartments</title>
13
+ <updated>2012-03-28T13-08-37Z</updated>
14
+ </source>
15
+ <service:provider xmlns:service="http://activitystrea.ms/service-provider">
16
+ <name>Twitter</name>
17
+ <uri>http://www.twitter.com/</uri>
18
+ <icon/>
19
+ </service:provider>
20
+ <activity:verb xmlns:activity="http://activitystrea.ms/spec/1.0/">http://activitystrea.ms/schema/1.0/post</activity:verb>
21
+ <activity:object xmlns:activity="http://activitystrea.ms/spec/1.0/">
22
+ <activity:object-type>http://activitystrea.ms/schema/1.0/note</activity:object-type>
23
+ <id>object:tag:search.twitter.com,2005:185095872315539457</id>
24
+ <content type="html">new york Curbed SF has rounded up four of San Francisco's tiniest abodes, which range in size from 34... <a href="http://t.co/UkXbbti2">http://t.co/UkXbbti2</a> <em>apartments</em></content>
25
+ <link rel="alternate" type="text/html" href="http://twitter.com/AskLaLa/statuses/185095872315539457"/>
26
+ </activity:object>
27
+ <author>
28
+ <name>AskLaLa</name>
29
+ <uri>http://twitter.com/AskLaLa</uri>
30
+ </author>
31
+ <activity:author xmlns:activity="http://activitystrea.ms/spec/1.0/">
32
+ <activity:object-type>http://activitystrea.ms/schema/1.0/person</activity:object-type>
33
+ <link rel="alternate" type="text/html" length="0" href="http://twitter.com/AskLaLa"/>
34
+ <link rel="avatar" type="image/png" href="http://a0.twimg.com/profile_images/1337100426/bellapippa_normal.jpg"/>
35
+ <id>http://twitter.com/AskLaLa</id>
36
+ </activity:author>
37
+ <activity:actor xmlns:activity="http://activitystrea.ms/spec/1.0/">
38
+ <activity:object-type>http://activitystrea.ms/schema/1.0/person</activity:object-type>
39
+ <link rel="alternate" type="text/html" length="0" href="http://twitter.com/AskLaLa"/>
40
+ <link rel="avatar" type="image/png" href="http://a0.twimg.com/profile_images/1337100426/bellapippa_normal.jpg"/>
41
+ <id>http://twitter.com/AskLaLa</id>
42
+ </activity:actor>
43
+ <gnip:matching_rules>
44
+ <gnip:matching_rule rel="source">apartments</gnip:matching_rule>
45
+ <gnip:matching_rule rel="inferred">apartments san francisco</gnip:matching_rule>
46
+ </gnip:matching_rules>
47
+ </entry>
@@ -87,6 +87,11 @@ describe GnipGnop::Entry do
87
87
  end
88
88
 
89
89
  it "should parse the matching rules" do
90
- @entry.matching_rule.rule.must_equal "apartments"
90
+ @entry.matching_rules.first.rule.must_equal "apartments"
91
+ end
92
+
93
+ it "should parse multiple matching rules" do
94
+ @entry = GnipGnop::Entry.parse(File.read(File.expand_path('../fixtures/entry_with_rules.xml', __FILE__)))
95
+ @entry.matching_rules.size.must_equal 2
91
96
  end
92
97
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gnip_gnop
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-21 00:00:00.000000000Z
12
+ date: 2012-03-28 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: happymapper
16
- requirement: &70126788536440 !ruby/object:Gem::Requirement
16
+ requirement: &70144149387440 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70126788536440
24
+ version_requirements: *70144149387440
25
25
  description: ! "A ruby library that given a Gnip activity\n stream
26
26
  XML <entry>, will allow you to\n interact with that entry
27
27
  as a first-class\n Ruby object."
@@ -50,6 +50,7 @@ files:
50
50
  - lib/gnip_gnop/source.rb
51
51
  - lib/gnip_gnop/version.rb
52
52
  - test/fixtures/entry.xml
53
+ - test/fixtures/entry_with_rules.xml
53
54
  - test/gnip_gnop_entry_test.rb
54
55
  - test/minitest_helper.rb
55
56
  homepage: https://www.github.com/ckraybill/gnip_gnop
@@ -78,5 +79,6 @@ specification_version: 3
78
79
  summary: Work with Gnip activity streams with joy
79
80
  test_files:
80
81
  - test/fixtures/entry.xml
82
+ - test/fixtures/entry_with_rules.xml
81
83
  - test/gnip_gnop_entry_test.rb
82
84
  - test/minitest_helper.rb