gnip 1.0.0 → 1.1.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.
data/bin/gnip CHANGED
@@ -633,7 +633,7 @@ Main {
633
633
  publisher = Gnip.publisher.for(publisher_name, :scope => scope)
634
634
  if publisher
635
635
  filter = publisher.filter.for(filter_name)
636
- rule = filter.rule.list(:type => type, :value => value)
636
+ rule = filter.rule.for(:type => type, :value => value)
637
637
  rule.delete
638
638
  y rule
639
639
  else
data/gemspec.rb CHANGED
@@ -1,47 +1,25 @@
1
- #! /usr/bin/env gem build
2
1
 
3
- require 'rubygems'
2
+ Gem::Specification::new do |spec|
3
+ spec.name = "gnip"
4
+ spec.version = "1.1.1"
5
+ spec.platform = Gem::Platform::RUBY
6
+ spec.summary = "gnip"
4
7
 
5
- Gem::Specification::new do |spec|
6
- $VERBOSE = nil
8
+ spec.files = ["bin", "bin/gnip", "doc", "doc/api.html", "gemspec.rb", "gnip-ruby.gemspec", "lib", "lib/gnip", "lib/gnip/activity.rb", "lib/gnip/api.rb", "lib/gnip/arguments.rb", "lib/gnip/blankslate.rb", "lib/gnip/config.rb", "lib/gnip/filter.rb", "lib/gnip/list.rb", "lib/gnip/options.rb", "lib/gnip/orderedhash.rb", "lib/gnip/publisher.rb", "lib/gnip/resource.rb", "lib/gnip/template.rb", "lib/gnip/util.rb", "lib/gnip.rb", "Rakefile", "README", "sample", "sample/data", "sample/data/activity.yml", "test", "test/auth.rb", "test/config.yml", "test/data", "test/data/activity.xml", "test/data/activity_only_required.xml", "test/data/activity_with_payload.xml", "test/data/activity_with_place.xml", "test/data/activity_with_place_wo_bounds.xml", "test/data/activity_with_unbounded_media_urls.xml", "test/data/activity_without_bounds.xml", "test/helper.rb", "test/integration", "test/integration/auth.rb", "test/integration/publisher.rb", "test/lib", "test/lib/shoulda", "test/lib/shoulda/action_controller", "test/lib/shoulda/action_controller/helpers.rb", "test/lib/shoulda/action_controller/macros.rb", "test/lib/shoulda/action_controller/matchers", "test/lib/shoulda/action_controller/matchers/assign_to_matcher.rb", "test/lib/shoulda/action_controller/matchers/filter_param_matcher.rb", "test/lib/shoulda/action_controller/matchers/render_with_layout_matcher.rb", "test/lib/shoulda/action_controller/matchers/respond_with_content_type_matcher.rb", "test/lib/shoulda/action_controller/matchers/respond_with_matcher.rb", "test/lib/shoulda/action_controller/matchers/route_matcher.rb", "test/lib/shoulda/action_controller/matchers/set_session_matcher.rb", "test/lib/shoulda/action_controller/matchers/set_the_flash_matcher.rb", "test/lib/shoulda/action_controller/matchers.rb", "test/lib/shoulda/action_controller.rb", "test/lib/shoulda/action_mailer", "test/lib/shoulda/action_mailer/assertions.rb", "test/lib/shoulda/action_mailer.rb", "test/lib/shoulda/action_view", "test/lib/shoulda/action_view/macros.rb", "test/lib/shoulda/action_view.rb", "test/lib/shoulda/active_record", "test/lib/shoulda/active_record/assertions.rb", "test/lib/shoulda/active_record/helpers.rb", "test/lib/shoulda/active_record/macros.rb", "test/lib/shoulda/active_record/matchers", "test/lib/shoulda/active_record/matchers/allow_mass_assignment_of_matcher.rb", "test/lib/shoulda/active_record/matchers/allow_value_matcher.rb", "test/lib/shoulda/active_record/matchers/association_matcher.rb", "test/lib/shoulda/active_record/matchers/ensure_inclusion_of_matcher.rb", "test/lib/shoulda/active_record/matchers/ensure_length_of_matcher.rb", "test/lib/shoulda/active_record/matchers/have_db_column_matcher.rb", "test/lib/shoulda/active_record/matchers/have_index_matcher.rb", "test/lib/shoulda/active_record/matchers/have_named_scope_matcher.rb", "test/lib/shoulda/active_record/matchers/have_readonly_attribute_matcher.rb", "test/lib/shoulda/active_record/matchers/validate_acceptance_of_matcher.rb", "test/lib/shoulda/active_record/matchers/validate_numericality_of_matcher.rb", "test/lib/shoulda/active_record/matchers/validate_presence_of_matcher.rb", "test/lib/shoulda/active_record/matchers/validate_uniqueness_of_matcher.rb", "test/lib/shoulda/active_record/matchers/validation_matcher.rb", "test/lib/shoulda/active_record/matchers.rb", "test/lib/shoulda/active_record.rb", "test/lib/shoulda/assertions.rb", "test/lib/shoulda/autoload_macros.rb", "test/lib/shoulda/context.rb", "test/lib/shoulda/helpers.rb", "test/lib/shoulda/macros.rb", "test/lib/shoulda/private_helpers.rb", "test/lib/shoulda/proc_extensions.rb", "test/lib/shoulda/rails.rb", "test/lib/shoulda/rspec.rb", "test/lib/shoulda/tasks", "test/lib/shoulda/tasks/list_tests.rake", "test/lib/shoulda/tasks/yaml_to_shoulda.rake", "test/lib/shoulda/tasks.rb", "test/lib/shoulda/test_unit.rb", "test/lib/shoulda.rb", "test/lib/xmlsimple.rb", "test/loader.rb", "test/unit", "test/unit/activity.rb", "test/unit/util.rb", "TODO"]
9
+ spec.executables = ["gnip"]
10
+
11
+ spec.require_path = "lib"
7
12
 
8
- shiteless = lambda do |list|
9
- list.delete_if do |file|
10
- file =~ %r/\.git/ or
11
- file =~ %r/\.svn/ or
12
- file =~ %r/\.tmp/
13
- end
14
- end
15
-
16
- spec.name = $lib
17
- spec.version = $version
18
- spec.platform = Gem::Platform::RUBY
19
- spec.summary = $lib
20
-
21
- spec.files = shiteless[Dir::glob("**/**")]
22
- spec.executables = shiteless[Dir::glob("bin/*")].map{|exe| File::basename(exe)}
23
-
24
- spec.require_path = "lib"
13
+ spec.has_rdoc = true
14
+ spec.test_files = nil
15
+ #spec.add_dependency 'lib', '>= version'
16
+ #spec.add_dependency 'fattr'
25
17
 
26
- spec.has_rdoc = true #File::exist? "doc"
27
- # spec.test_suite_file = "test/#{ $lib }.rb" if File::file?("test/#{ $lib }.rb")
28
- spec.add_dependency 'rest-client'
29
- spec.add_dependency 'nokogiri'
30
- spec.add_dependency 'threadify'
31
- spec.add_dependency 'tagz', '>= 5.0.1'
32
-
33
- spec.extensions << "extconf.rb" if File::exists? "extconf.rb"
34
-
35
- spec.rubyforge_project = 'gnip'
36
- spec.author = "Ara T. Howard"
37
- spec.email = "ara.t.howard@gmail.com"
38
- spec.homepage = "http://gnip.com"
39
- end
18
+ spec.extensions.push(*["rakefile", "Rakefile"])
40
19
 
20
+ spec.rubyforge_project = 'codeforpeople'
21
+ spec.author = "Ara T. Howard"
22
+ spec.email = "ara.t.howard@gmail.com"
23
+ spec.homepage = "http://github.com/ahoward/gnip/tree/master"
24
+ end
41
25
 
42
- BEGIN{
43
- Dir.chdir(File.dirname(__FILE__))
44
- $lib = 'gnip'
45
- Kernel.load "./lib/#{ $lib }.rb"
46
- $version = Gnip.version
47
- }
data/gnip-ruby.gemspec ADDED
@@ -0,0 +1,25 @@
1
+
2
+ Gem::Specification::new do |spec|
3
+ spec.name = "gnip"
4
+ spec.version = "1.1.1"
5
+ spec.platform = Gem::Platform::RUBY
6
+ spec.summary = "gnip"
7
+
8
+ spec.files = ["bin", "bin/gnip", "doc", "doc/api.html", "gemspec.rb", "gnip-ruby.gemspec", "lib", "lib/gnip", "lib/gnip/activity.rb", "lib/gnip/api.rb", "lib/gnip/arguments.rb", "lib/gnip/blankslate.rb", "lib/gnip/config.rb", "lib/gnip/filter.rb", "lib/gnip/list.rb", "lib/gnip/options.rb", "lib/gnip/orderedhash.rb", "lib/gnip/publisher.rb", "lib/gnip/resource.rb", "lib/gnip/template.rb", "lib/gnip/util.rb", "lib/gnip.rb", "Rakefile", "README", "sample", "sample/data", "sample/data/activity.yml", "test", "test/auth.rb", "test/config.yml", "test/data", "test/data/activity.xml", "test/data/activity_only_required.xml", "test/data/activity_with_payload.xml", "test/data/activity_with_place.xml", "test/data/activity_with_place_wo_bounds.xml", "test/data/activity_with_unbounded_media_urls.xml", "test/data/activity_without_bounds.xml", "test/helper.rb", "test/integration", "test/integration/auth.rb", "test/integration/publisher.rb", "test/lib", "test/lib/shoulda", "test/lib/shoulda/action_controller", "test/lib/shoulda/action_controller/helpers.rb", "test/lib/shoulda/action_controller/macros.rb", "test/lib/shoulda/action_controller/matchers", "test/lib/shoulda/action_controller/matchers/assign_to_matcher.rb", "test/lib/shoulda/action_controller/matchers/filter_param_matcher.rb", "test/lib/shoulda/action_controller/matchers/render_with_layout_matcher.rb", "test/lib/shoulda/action_controller/matchers/respond_with_content_type_matcher.rb", "test/lib/shoulda/action_controller/matchers/respond_with_matcher.rb", "test/lib/shoulda/action_controller/matchers/route_matcher.rb", "test/lib/shoulda/action_controller/matchers/set_session_matcher.rb", "test/lib/shoulda/action_controller/matchers/set_the_flash_matcher.rb", "test/lib/shoulda/action_controller/matchers.rb", "test/lib/shoulda/action_controller.rb", "test/lib/shoulda/action_mailer", "test/lib/shoulda/action_mailer/assertions.rb", "test/lib/shoulda/action_mailer.rb", "test/lib/shoulda/action_view", "test/lib/shoulda/action_view/macros.rb", "test/lib/shoulda/action_view.rb", "test/lib/shoulda/active_record", "test/lib/shoulda/active_record/assertions.rb", "test/lib/shoulda/active_record/helpers.rb", "test/lib/shoulda/active_record/macros.rb", "test/lib/shoulda/active_record/matchers", "test/lib/shoulda/active_record/matchers/allow_mass_assignment_of_matcher.rb", "test/lib/shoulda/active_record/matchers/allow_value_matcher.rb", "test/lib/shoulda/active_record/matchers/association_matcher.rb", "test/lib/shoulda/active_record/matchers/ensure_inclusion_of_matcher.rb", "test/lib/shoulda/active_record/matchers/ensure_length_of_matcher.rb", "test/lib/shoulda/active_record/matchers/have_db_column_matcher.rb", "test/lib/shoulda/active_record/matchers/have_index_matcher.rb", "test/lib/shoulda/active_record/matchers/have_named_scope_matcher.rb", "test/lib/shoulda/active_record/matchers/have_readonly_attribute_matcher.rb", "test/lib/shoulda/active_record/matchers/validate_acceptance_of_matcher.rb", "test/lib/shoulda/active_record/matchers/validate_numericality_of_matcher.rb", "test/lib/shoulda/active_record/matchers/validate_presence_of_matcher.rb", "test/lib/shoulda/active_record/matchers/validate_uniqueness_of_matcher.rb", "test/lib/shoulda/active_record/matchers/validation_matcher.rb", "test/lib/shoulda/active_record/matchers.rb", "test/lib/shoulda/active_record.rb", "test/lib/shoulda/assertions.rb", "test/lib/shoulda/autoload_macros.rb", "test/lib/shoulda/context.rb", "test/lib/shoulda/helpers.rb", "test/lib/shoulda/macros.rb", "test/lib/shoulda/private_helpers.rb", "test/lib/shoulda/proc_extensions.rb", "test/lib/shoulda/rails.rb", "test/lib/shoulda/rspec.rb", "test/lib/shoulda/tasks", "test/lib/shoulda/tasks/list_tests.rake", "test/lib/shoulda/tasks/yaml_to_shoulda.rake", "test/lib/shoulda/tasks.rb", "test/lib/shoulda/test_unit.rb", "test/lib/shoulda.rb", "test/lib/xmlsimple.rb", "test/loader.rb", "test/unit", "test/unit/activity.rb", "test/unit/util.rb", "TODO"]
9
+ spec.executables = ["gnip"]
10
+
11
+ spec.require_path = "lib"
12
+
13
+ spec.has_rdoc = true
14
+ spec.test_files = nil
15
+ #spec.add_dependency 'lib', '>= version'
16
+ #spec.add_dependency 'fattr'
17
+
18
+ spec.extensions.push(*["rakefile", "Rakefile"])
19
+
20
+ spec.rubyforge_project = 'codeforpeople'
21
+ spec.author = "Ara T. Howard"
22
+ spec.email = "ara.t.howard@gmail.com"
23
+ spec.homepage = "http://github.com/ahoward/gnip/tree/master"
24
+ end
25
+
data/lib/gnip/activity.rb CHANGED
@@ -269,6 +269,8 @@ module Gnip
269
269
  @payload = Payload.for(value)
270
270
  end
271
271
 
272
+ attr_accessor :gnip_resource_uri
273
+
272
274
  def initialize(options = {})
273
275
  options = Gnip.options_for(options)
274
276
  options.each{|key, value| send("#{ key }=", value)}
data/lib/gnip/filter.rb CHANGED
@@ -200,9 +200,11 @@ module Gnip
200
200
  def to_xml(*args)
201
201
  tagz {
202
202
  filter_(:name => name, :fullData => !!full_data){
203
+ postURL_{ post_url } if post_url
203
204
  rules.each do |rule|
204
205
  rule_(:type => rule.type){ rule.value }
205
206
  end
207
+ nil
206
208
  }
207
209
  }
208
210
  end
@@ -284,6 +286,11 @@ module Gnip
284
286
  rule
285
287
  end
286
288
 
289
+ def for(*args)
290
+ rule = Rule.for(*args)
291
+ list(:type => rule.type, :value => rule.value)
292
+ end
293
+
287
294
  def delete options = {}
288
295
  list(options).delete(:filter => filter)
289
296
  end
@@ -212,6 +212,7 @@ module Gnip
212
212
 
213
213
  filter = options.getopt(:filter)
214
214
  filter = filter.value if(filter and filter.respond_to?(:value))
215
+ filter = filter.name if(filter and filter.respond_to?(:name))
215
216
 
216
217
  buckets =
217
218
  if thru
@@ -227,6 +228,10 @@ module Gnip
227
228
  end
228
229
  end
229
230
 
231
+ buckets.map! do |bucket|
232
+ bucket.is_a?(Time) ? bucket.strftime('%Y%m%d%H%M') : bucket
233
+ end
234
+
230
235
  activities = []
231
236
 
232
237
  msg = buckets.size > 1 ? 'threadify' : 'each'
@@ -235,8 +240,10 @@ module Gnip
235
240
  path = "#{ style }/#{ bucket }.xml"
236
241
  path = "filters/#{ filter }/#{ path }" if filter
237
242
  xml = resource[path].get
238
- list = Activity.list_from_xml(xml, &block)
239
- activities.push(*list) unless block
243
+ Activity.list_from_xml(xml) do |activity|
244
+ activity.gnip_resource_uri = resource[path].uri
245
+ block ? block.call(activity) : activities.push(activity)
246
+ end
240
247
  end
241
248
 
242
249
  activities unless block
data/lib/gnip/resource.rb CHANGED
@@ -165,7 +165,7 @@ module Gnip
165
165
  def wrapping_errors
166
166
  begin
167
167
  yield
168
- rescue Exception => error
168
+ rescue => error
169
169
  message = []
170
170
  message << error.message if error.respond_to?(:message) rescue nil
171
171
  message << error.response.body if error.respond_to?(:response) rescue nil
data/lib/gnip.rb CHANGED
@@ -43,7 +43,7 @@
43
43
  # gnip libs
44
44
  #
45
45
  module Gnip
46
- Version = '1.0.0'
46
+ Version = '1.1.1'
47
47
 
48
48
  def version
49
49
  Gnip::Version
data/rakefile ADDED
@@ -0,0 +1,53 @@
1
+ task 'default' => 'test:all'
2
+
3
+ namespace 'test' do
4
+ desc 'run all tests'
5
+ task 'all' => %w[ unit integration ] do
6
+ end
7
+
8
+ desc 'run unit tests'
9
+ task 'unit' do
10
+ %w[
11
+ activity
12
+ ].each do |basename|
13
+ test_loader "test/unit/#{ basename }.rb"
14
+ end
15
+ end
16
+
17
+ desc 'run integration tests'
18
+ task 'integration' do
19
+ %w[
20
+ auth
21
+ publisher
22
+ ].each do |basename|
23
+ test_loader "test/integration/#{ basename }.rb", :require_auth => true
24
+ end
25
+ end
26
+ end
27
+
28
+ task 'test' => 'test:all' do
29
+ end
30
+
31
+ namespace 'gem' do
32
+ task 'build' do
33
+ sh 'gemspec.rb'
34
+ end
35
+ task 'release' => 'build' do
36
+ gem = Dir['gnip*.gem'].sort.last or abort('no gem!')
37
+ version = gem[%r/[\d.]+/]
38
+ command = "rubyforge login && rubyforge add_release gnip 'gnip' '#{ version }' '#{ gem }'"
39
+ sh command
40
+ end
41
+ end
42
+
43
+ BEGIN {
44
+ Dir.chdir(File.dirname(__FILE__))
45
+ ENV['PATH'] = [ '.', './bin/', ENV['PATH'] ].join(File::PATH_SEPARATOR)
46
+
47
+ def test_loader basename, options = {}
48
+ auth = '-r test/auth.rb ' if options[:require_auth]
49
+ command = "ruby -r test/loader.rb #{ auth }#{ basename }"
50
+ STDERR.print "\n==== TEST ====\n\n #{ command }\n\n==============\n\n"
51
+ system command or abort("#{ command } # FAILED WITH #{ $?.inspect }")
52
+ end
53
+ }
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gnip
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ara T. Howard
@@ -9,55 +9,17 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-03-27 00:00:00 -06:00
12
+ date: 2009-06-08 00:00:00 -06:00
13
13
  default_executable:
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
16
- name: rest-client
17
- type: :runtime
18
- version_requirement:
19
- version_requirements: !ruby/object:Gem::Requirement
20
- requirements:
21
- - - ">="
22
- - !ruby/object:Gem::Version
23
- version: "0"
24
- version:
25
- - !ruby/object:Gem::Dependency
26
- name: nokogiri
27
- type: :runtime
28
- version_requirement:
29
- version_requirements: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - ">="
32
- - !ruby/object:Gem::Version
33
- version: "0"
34
- version:
35
- - !ruby/object:Gem::Dependency
36
- name: threadify
37
- type: :runtime
38
- version_requirement:
39
- version_requirements: !ruby/object:Gem::Requirement
40
- requirements:
41
- - - ">="
42
- - !ruby/object:Gem::Version
43
- version: "0"
44
- version:
45
- - !ruby/object:Gem::Dependency
46
- name: tagz
47
- type: :runtime
48
- version_requirement:
49
- version_requirements: !ruby/object:Gem::Requirement
50
- requirements:
51
- - - ">="
52
- - !ruby/object:Gem::Version
53
- version: 5.0.1
54
- version:
14
+ dependencies: []
15
+
55
16
  description:
56
17
  email: ara.t.howard@gmail.com
57
18
  executables:
58
19
  - gnip
59
- extensions: []
60
-
20
+ extensions:
21
+ - rakefile
22
+ - Rakefile
61
23
  extra_rdoc_files: []
62
24
 
63
25
  files:
@@ -66,8 +28,7 @@ files:
66
28
  - doc
67
29
  - doc/api.html
68
30
  - gemspec.rb
69
- - gnip-0.4.2.gem
70
- - gnip-1.0.0.gem
31
+ - gnip-ruby.gemspec
71
32
  - lib
72
33
  - lib/gnip
73
34
  - lib/gnip/activity.rb
@@ -101,7 +62,6 @@ files:
101
62
  - test/data/activity_with_unbounded_media_urls.xml
102
63
  - test/data/activity_without_bounds.xml
103
64
  - test/helper.rb
104
- - test/helper.rb.bak
105
65
  - test/integration
106
66
  - test/integration/auth.rb
107
67
  - test/integration/publisher.rb
@@ -170,7 +130,7 @@ files:
170
130
  - test/unit/util.rb
171
131
  - TODO
172
132
  has_rdoc: true
173
- homepage: http://gnip.com
133
+ homepage: http://github.com/ahoward/gnip/tree/master
174
134
  post_install_message:
175
135
  rdoc_options: []
176
136
 
@@ -190,7 +150,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
190
150
  version:
191
151
  requirements: []
192
152
 
193
- rubyforge_project: gnip
153
+ rubyforge_project: codeforpeople
194
154
  rubygems_version: 1.3.1
195
155
  signing_key:
196
156
  specification_version: 2
data/gnip-0.4.2.gem DELETED
Binary file
data/gnip-1.0.0.gem DELETED
Binary file
data/test/helper.rb.bak DELETED
@@ -1,28 +0,0 @@
1
- module Gnip
2
- module Test
3
- module Helper
4
- def xml_cmp(a, b)
5
- eq_all_but_zero = Object.new.instance_eval do
6
- def ==(other)
7
- Integer(other) == 0 ? false : true
8
- end
9
- self
10
- end
11
- a = XmlSimple.xml_in(a.to_s, 'normalisespace' => eq_all_but_zero)
12
- b = XmlSimple.xml_in(b.to_s, 'normalisespace' => eq_all_but_zero)
13
- a == b
14
- end
15
- end
16
- end
17
- end
18
-
19
- module Kernel
20
- private
21
- def Test(*args, &block)
22
- Class.new(::Test::Unit::TestCase) do
23
- include Gnip::Test::Helper
24
- args.push 'default' if args.empty?
25
- context(*args, &block)
26
- end
27
- end
28
- end