pingfm 1.0.2 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,2 @@
1
+ ---
2
+ app_key: 'TEST_APP_KEY'
@@ -1,33 +1,22 @@
1
- # $Id$
1
+ require 'rspec'
2
+ require "#{File.dirname(__FILE__)}/../lib/pingfm"
2
3
 
3
- require File.expand_path(
4
- File.join(File.dirname(__FILE__), %w[.. lib pingfm]))
5
-
6
- # Spec::Runner.configure do |config|
7
- # == Mock Framework
8
- #
9
- # RSpec uses it's own mocking framework by default. If you prefer to
10
- # use mocha, flexmock or RR, uncomment the appropriate line:
11
- #
12
- # config.mock_with :mocha
13
- # config.mock_with :flexmock
14
- # config.mock_with :rr
15
- # end
16
-
17
- def init_ok_response(service_type)
18
- @service_type = service_type
19
- @response = <<EOXML
4
+ # TODO: Replace this XML string bullshit.
5
+ RSpec.configure do |config|
6
+ def init_ok_response(service_type)
7
+ @service_type = service_type
8
+ @response = <<EOXML
20
9
  <?xml version="1.0"?>
21
10
  <rsp status="OK">
22
11
  <transaction>12345</transaction>
23
12
  <method>#{@service_type}</method>
24
13
  </rsp>
25
14
  EOXML
26
- end
15
+ end
27
16
 
28
- def init_fail_response(service_type)
29
- @service_type = service_type
30
- @response = <<EOXML
17
+ def init_fail_response(service_type)
18
+ @service_type = service_type
19
+ @response = <<EOXML
31
20
  <?xml version="1.0"?>
32
21
  <rsp status="FAIL">
33
22
  <transaction>12345</transaction>
@@ -35,11 +24,11 @@ def init_fail_response(service_type)
35
24
  <message>You suck</message>
36
25
  </rsp>
37
26
  EOXML
38
- end
27
+ end
39
28
 
40
- def init_service_response
41
- @service_type = 'user.services'
42
- @response = <<EOXML
29
+ def init_service_response
30
+ @service_type = 'user.services'
31
+ @response = <<EOXML
43
32
  <?xml version="1.0"?>
44
33
  <rsp status="OK">
45
34
  <transaction>12345</transaction>
@@ -60,11 +49,11 @@ def init_service_response
60
49
  </services>
61
50
  </rsp>
62
51
  EOXML
63
- end
52
+ end
64
53
 
65
- def init_system_services_response
66
- @service_type = 'system.services'
67
- @response = <<EOXML
54
+ def init_system_services_response
55
+ @service_type = 'system.services'
56
+ @response = <<EOXML
68
57
  <rsp status="OK">
69
58
  <transaction>12345</transaction>
70
59
  <method>system.services</method>
@@ -82,11 +71,11 @@ def init_system_services_response
82
71
  </services>
83
72
  </rsp>
84
73
  EOXML
85
- end
74
+ end
86
75
 
87
- def init_trigger_response
88
- @service_type = 'user.triggers'
89
- @response = <<EOXML
76
+ def init_trigger_response
77
+ @service_type = 'user.triggers'
78
+ @response = <<EOXML
90
79
  <?xml version="1.0"?>
91
80
  <rsp status="OK">
92
81
  <transaction>12345</transaction>
@@ -105,11 +94,11 @@ def init_trigger_response
105
94
  </triggers>
106
95
  </rsp>
107
96
  EOXML
108
- end
97
+ end
109
98
 
110
- def init_latest_response
111
- @service_type = 'user.latest'
112
- @response = <<EOXML
99
+ def init_latest_response
100
+ @service_type = 'user.latest'
101
+ @response = <<EOXML
113
102
  <?xml version="1.0"?>
114
103
  <rsp status="OK">
115
104
  <transaction>12345</transaction>
@@ -148,6 +137,5 @@ def init_latest_response
148
137
  </messages>
149
138
  </rsp>
150
139
  EOXML
140
+ end
151
141
  end
152
-
153
- # EOF
metadata CHANGED
@@ -1,85 +1,88 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: pingfm
3
- version: !ruby/object:Gem::Version
4
- version: 1.0.2
3
+ version: !ruby/object:Gem::Version
4
+ version: 2.0.0
5
+ prerelease:
5
6
  platform: ruby
6
- authors:
7
- - Krunoslav Husak
7
+ authors:
8
8
  - Dale Campbell
9
9
  - Kevin Williams
10
+ - Krunoslav Husak
10
11
  autorequire:
11
12
  bindir: bin
12
13
  cert_chain: []
13
-
14
- date: 2009-09-27 00:00:00 -05:00
15
- default_executable:
16
- dependencies: []
17
-
18
- description: Ping.fm (http://ping.fm) is a simple service that makes updating your social networks a snap, and this it's Ruby library.
19
- email:
20
- - dale@save-state.net
14
+ date: 2011-06-12 00:00:00.000000000Z
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
17
+ name: slop
18
+ requirement: &75088130 !ruby/object:Gem::Requirement
19
+ none: false
20
+ requirements:
21
+ - - ! '>='
22
+ - !ruby/object:Gem::Version
23
+ version: '0'
24
+ type: :runtime
25
+ prerelease: false
26
+ version_requirements: *75088130
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec
29
+ requirement: &75087470 !ruby/object:Gem::Requirement
30
+ none: false
31
+ requirements:
32
+ - - ! '>='
33
+ - !ruby/object:Gem::Version
34
+ version: 2.6.0
35
+ type: :development
36
+ prerelease: false
37
+ version_requirements: *75087470
38
+ description: Ping.fm (http://ping.fm) is a simple service that makes updating your
39
+ social networks a snap, and this it's Ruby library.
40
+ email:
41
+ - oshuma@gmail.com
21
42
  - kevwil@gmail.com
22
- executables:
43
+ executables:
23
44
  - pingfm
24
45
  extensions: []
25
-
26
- extra_rdoc_files:
27
- - History.txt
28
- - bin/pingfm
29
- files:
46
+ extra_rdoc_files: []
47
+ files:
30
48
  - .gitignore
31
- - History.txt
32
- - Manifest.txt
33
- - README
49
+ - Gemfile
50
+ - Gemfile.lock
51
+ - README.rdoc
34
52
  - Rakefile
35
53
  - bin/pingfm
36
54
  - lib/pingfm.rb
37
55
  - lib/pingfm/client.rb
38
- - lib/pingfm/keyloader.rb
39
- - spec/keyloader_spec.rb
56
+ - lib/pingfm/config.rb
57
+ - pingfm.gemspec
58
+ - spec/pingfm/client_spec.rb
59
+ - spec/pingfm/config_spec.rb
40
60
  - spec/pingfm_spec.rb
61
+ - spec/pingfm_spec.yml
41
62
  - spec/spec_helper.rb
42
- - tasks/ann.rake
43
- - tasks/bones.rake
44
- - tasks/gem.rake
45
- - tasks/git.rake
46
- - tasks/manifest.rake
47
- - tasks/notes.rake
48
- - tasks/post_load.rake
49
- - tasks/rdoc.rake
50
- - tasks/rubyforge.rake
51
- - tasks/setup.rb
52
- - tasks/spec.rake
53
- - tasks/svn.rake
54
- - tasks/test.rake
55
- has_rdoc: true
56
- homepage: http://pingfm.rubyforge.org/
63
+ homepage: http://github.com/Oshuma/pingfm
57
64
  licenses: []
58
-
59
65
  post_install_message:
60
- rdoc_options:
61
- - --main
62
- - README
63
- require_paths:
66
+ rdoc_options:
67
+ - --inline-source
68
+ require_paths:
64
69
  - lib
65
- required_ruby_version: !ruby/object:Gem::Requirement
66
- requirements:
67
- - - ">="
68
- - !ruby/object:Gem::Version
69
- version: "0"
70
- version:
71
- required_rubygems_version: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- version: "0"
76
- version:
70
+ required_ruby_version: !ruby/object:Gem::Requirement
71
+ none: false
72
+ requirements:
73
+ - - ! '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ required_rubygems_version: !ruby/object:Gem::Requirement
77
+ none: false
78
+ requirements:
79
+ - - ! '>='
80
+ - !ruby/object:Gem::Version
81
+ version: '0'
77
82
  requirements: []
78
-
79
83
  rubyforge_project: pingfm
80
- rubygems_version: 1.3.5
84
+ rubygems_version: 1.8.5
81
85
  signing_key:
82
86
  specification_version: 3
83
- summary: Ping.fm (http://ping.fm) is a simple service that makes updating your social networks a snap, and this it's Ruby library.
87
+ summary: A Ping.fm Ruby library.
84
88
  test_files: []
85
-
@@ -1,12 +0,0 @@
1
- == 1.0.2 / 2009-06-10
2
-
3
- * Patched Client#status_fail to handle responses with no error message
4
-
5
- == 1.0.1 / 2008-12-26
6
-
7
- * Fixed small bug in the command-line script.
8
-
9
- == 1.0.0 / 2008-09-25
10
-
11
- * first gem release
12
- * woohoo!
@@ -1,25 +0,0 @@
1
- .gitignore
2
- History.txt
3
- Manifest.txt
4
- README
5
- Rakefile
6
- bin/pingfm
7
- lib/pingfm.rb
8
- lib/pingfm/client.rb
9
- lib/pingfm/keyloader.rb
10
- spec/keyloader_spec.rb
11
- spec/pingfm_spec.rb
12
- spec/spec_helper.rb
13
- tasks/ann.rake
14
- tasks/bones.rake
15
- tasks/gem.rake
16
- tasks/git.rake
17
- tasks/manifest.rake
18
- tasks/notes.rake
19
- tasks/post_load.rake
20
- tasks/rdoc.rake
21
- tasks/rubyforge.rake
22
- tasks/setup.rb
23
- tasks/spec.rake
24
- tasks/svn.rake
25
- tasks/test.rake
@@ -1,58 +0,0 @@
1
- require 'yaml'
2
-
3
- module Pingfm
4
-
5
- class KeyloadingError < Exception; end
6
-
7
- # manages the YAML file containing the keys - encryption might be nice, might be overkill
8
- class Keyloader
9
-
10
- # Path to YAML file containing keys
11
- attr_accessor :keyfile
12
-
13
- # ping.fm uses this as the key for the registered application
14
- attr_accessor :api_key
15
-
16
- # ping.fm uses this as the key for the user
17
- attr_accessor :app_key
18
-
19
- KEY_PATH = (RUBY_PLATFORM =~ /mswin32/ ? ENV['HOMEPATH'] : ENV['HOME'])
20
- KEY_FILE = '.pingfm_keys.yml'
21
-
22
- def initialize(keyfile = File.expand_path(File.join(KEY_PATH, KEY_FILE)))
23
- @api_key = nil
24
- @keyfile = keyfile
25
-
26
- # load keys on init
27
- load_keys!
28
- end
29
-
30
- # load a new set of keys
31
- def load_keys(keyfile)
32
- if File.exist?(keyfile) and File.readable?(keyfile)
33
- data = YAML::load_file(keyfile)
34
- @keyfile = keyfile if @keyfile.nil?
35
- @api_key = data['api_key']
36
- @app_key = data['app_key']
37
- end
38
- end
39
-
40
- # load keys using the known keyfile
41
- def load_keys!
42
- load_keys(@keyfile)
43
- end
44
-
45
- # if keys have been loaded successfully
46
- def has_keys?
47
- return true unless @api_key.nil? or @app_key.nil?
48
- return false
49
- end
50
-
51
- # save key data to keyfile
52
- def save
53
- File.open( @keyfile, 'w+' ) do |out|
54
- YAML::dump( {'api_key' => @api_key, 'app_key' => @app_key}, out )
55
- end
56
- end
57
- end
58
- end
@@ -1,43 +0,0 @@
1
- require File.join(File.dirname(__FILE__), %w[spec_helper])
2
- require 'tempfile'
3
-
4
- describe Pingfm::Keyloader do
5
-
6
- before(:each) do
7
- @keydata = {'api_key' => 'foo', 'app_key' => 'bar'}
8
- @tf = Tempfile.new('keys.yml')
9
- YAML::dump(@keydata, @tf)
10
- @tmp_path = @tf.path
11
- @tf.close
12
- end
13
-
14
- after(:each) do
15
- @tf.unlink
16
- end
17
-
18
- it "should use keys from yaml file if found" do
19
- loader = Pingfm::Keyloader.new(@tmp_path)
20
- loader.has_keys?.should be_true
21
- loader.keyfile.should eql(@tmp_path)
22
- loader.api_key.should eql(@keydata['api_key'])
23
- loader.app_key.should eql(@keydata['app_key'])
24
- end
25
-
26
- it "should save keys to keyfile" do
27
- loader = Pingfm::Keyloader.new(@tmp_path)
28
- loader.app_key = 'baz'
29
- loader.save
30
-
31
- loader.has_keys?.should be_true
32
- File.exist?(loader.keyfile).should be_true
33
- File.readable?(loader.keyfile).should be_true
34
- YAML::load_file(loader.keyfile)['app_key'].should eql('baz')
35
- end
36
-
37
- it "should behave if keys cannot be loaded" do
38
- loader = Pingfm::Keyloader.new('/tmp/nofile')
39
- loader.has_keys?.should be_false
40
- loader.api_key.should be_nil
41
- loader.app_key.should be_nil
42
- end
43
- end
@@ -1,81 +0,0 @@
1
- # $Id$
2
-
3
- begin
4
- require 'bones/smtp_tls'
5
- rescue LoadError
6
- require 'net/smtp'
7
- end
8
- require 'time'
9
-
10
- namespace :ann do
11
-
12
- # A prerequisites task that all other tasks depend upon
13
- task :prereqs
14
-
15
- file PROJ.ann.file do
16
- ann = PROJ.ann
17
- puts "Generating #{ann.file}"
18
- File.open(ann.file,'w') do |fd|
19
- fd.puts("#{PROJ.name} version #{PROJ.version}")
20
- fd.puts(" by #{Array(PROJ.authors).first}") if PROJ.authors
21
- fd.puts(" #{PROJ.url}") if PROJ.url.valid?
22
- fd.puts(" (the \"#{PROJ.release_name}\" release)") if PROJ.release_name
23
- fd.puts
24
- fd.puts("== DESCRIPTION")
25
- fd.puts
26
- fd.puts(PROJ.description)
27
- fd.puts
28
- fd.puts(PROJ.changes.sub(%r/^.*$/, '== CHANGES'))
29
- fd.puts
30
- ann.paragraphs.each do |p|
31
- fd.puts "== #{p.upcase}"
32
- fd.puts
33
- fd.puts paragraphs_of(PROJ.readme_file, p).join("\n\n")
34
- fd.puts
35
- end
36
- fd.puts ann.text if ann.text
37
- end
38
- end
39
-
40
- desc "Create an announcement file"
41
- task :announcement => ['ann:prereqs', PROJ.ann.file]
42
-
43
- desc "Send an email announcement"
44
- task :email => ['ann:prereqs', PROJ.ann.file] do
45
- ann = PROJ.ann
46
- from = ann.email[:from] || PROJ.email
47
- to = Array(ann.email[:to])
48
-
49
- ### build a mail header for RFC 822
50
- rfc822msg = "From: #{from}\n"
51
- rfc822msg << "To: #{to.join(',')}\n"
52
- rfc822msg << "Subject: [ANN] #{PROJ.name} #{PROJ.version}"
53
- rfc822msg << " (#{PROJ.release_name})" if PROJ.release_name
54
- rfc822msg << "\n"
55
- rfc822msg << "Date: #{Time.new.rfc822}\n"
56
- rfc822msg << "Message-Id: "
57
- rfc822msg << "<#{"%.8f" % Time.now.to_f}@#{ann.email[:domain]}>\n\n"
58
- rfc822msg << File.read(ann.file)
59
-
60
- params = [:server, :port, :domain, :acct, :passwd, :authtype].map do |key|
61
- ann.email[key]
62
- end
63
-
64
- params[3] = PROJ.email if params[3].nil?
65
-
66
- if params[4].nil?
67
- STDOUT.write "Please enter your e-mail password (#{params[3]}): "
68
- params[4] = STDIN.gets.chomp
69
- end
70
-
71
- ### send email
72
- Net::SMTP.start(*params) {|smtp| smtp.sendmail(rfc822msg, from, to)}
73
- end
74
- end # namespace :ann
75
-
76
- desc 'Alias to ann:announcement'
77
- task :ann => 'ann:announcement'
78
-
79
- CLOBBER << PROJ.ann.file
80
-
81
- # EOF