dcparker-sping 0.0.1 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/History.txt CHANGED
@@ -1,4 +1,4 @@
1
- == 0.0.1 2008-07-02
1
+ == 0.0.1 2008-07-15
2
2
 
3
3
  * 1 major enhancement:
4
4
  * Initial release
data/Manifest.txt CHANGED
@@ -1,25 +1,10 @@
1
1
  History.txt
2
2
  License.txt
3
- Manifest.txt
4
- PostInstall.txt
5
3
  README.txt
6
- Rakefile
7
- config/hoe.rb
8
- config/requirements.rb
9
4
  lib/sping.rb
5
+ lib/sping/feed.rb
6
+ lib/sping/message.rb
10
7
  lib/sping/version.rb
11
- script/console
12
- script/destroy
13
- script/generate
14
- script/txt2html
15
8
  setup.rb
16
- tasks/deployment.rake
17
- tasks/environment.rake
18
- tasks/website.rake
19
9
  test/test_helper.rb
20
10
  test/test_sping.rb
21
- website/index.html
22
- website/index.txt
23
- website/javascripts/rounded_corners_lite.inc.js
24
- website/stylesheets/screen.css
25
- website/template.html.erb
data/lib/sping/feed.rb ADDED
@@ -0,0 +1,18 @@
1
+ module Sping
2
+ class Feed
3
+ attr_reader :api_key, :api_secret
4
+
5
+ def initialize(api_key, api_secret)
6
+ @api_key = api_key
7
+ @api_secret = api_secret
8
+ end
9
+
10
+ def post(content)
11
+ Sping::Message.create(:feed => self, :content => content)
12
+ end
13
+
14
+ def get(options={})
15
+ Sping::Message.get(options, {:feed => self})
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,33 @@
1
+ require 'simple_mapper'
2
+
3
+ module Sping
4
+ class Message
5
+ include SimpleMapper::Persistence
6
+ set_format :json
7
+ add_connection_adapter(:http) do
8
+ set_base_url 'http://statusping.com/messages'
9
+ end
10
+
11
+ has :properties
12
+ property :feed
13
+ property :created_by
14
+ property :content
15
+ property :created_at
16
+
17
+ uses :callbacks
18
+ # Adds HTTP Basic Auth to the request
19
+ add_callback('initialize_request') do |request,options|
20
+ nonce = Digest::SHA1.hexdigest("--#{rand(1234)}--#{Time.now.to_s}--#{rand(2345)}--")
21
+ feed = options[:instance] ? options[:instance].feed : options[:request_options][:feed]
22
+ username = feed.api_key
23
+ password = Digest::SHA1.hexdigest("#{nonce}#{feed.api_secret}")
24
+ request.add_query_param(:nonce => nonce)
25
+ request.basic_auth(username, password)
26
+ request
27
+ end
28
+
29
+ def to_hash(options={})
30
+ {:content => content}
31
+ end
32
+ end
33
+ end
data/lib/sping/version.rb CHANGED
@@ -1,8 +1,8 @@
1
1
  module Sping #:nodoc:
2
2
  module VERSION #:nodoc:
3
3
  MAJOR = 0
4
- MINOR = 0
5
- TINY = 1
4
+ MINOR = 1
5
+ TINY = 0
6
6
 
7
7
  STRING = [MAJOR, MINOR, TINY].join('.')
8
8
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dcparker-sping
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Daniel Parker
@@ -12,6 +12,15 @@ cert_chain: []
12
12
  date: 2008-07-15 00:00:00 -07:00
13
13
  default_executable:
14
14
  dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: simplemapper
17
+ version_requirement:
18
+ version_requirements: !ruby/object:Gem::Requirement
19
+ requirements:
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 0.1.0
23
+ version:
15
24
  - !ruby/object:Gem::Dependency
16
25
  name: hoe
17
26
  version_requirement:
@@ -32,21 +41,19 @@ extra_rdoc_files:
32
41
  - History.txt
33
42
  - License.txt
34
43
  - Manifest.txt
35
- - PostInstall.txt
36
44
  - README.txt
37
- - website/index.txt
38
45
  files:
39
46
  - History.txt
40
47
  - License.txt
41
- - Manifest.txt
42
48
  - README.txt
43
49
  - lib/sping.rb
50
+ - lib/sping/feed.rb
51
+ - lib/sping/message.rb
44
52
  - lib/sping/version.rb
45
53
  - setup.rb
46
54
  - test/test_helper.rb
47
55
  - test/test_sping.rb
48
- - PostInstall.txt
49
- - website/index.txt
56
+ - Manifest.txt
50
57
  has_rdoc: true
51
58
  homepage: http://sping.rubyforge.org
52
59
  post_install_message: |
data/PostInstall.txt DELETED
@@ -1,7 +0,0 @@
1
-
2
- For more information on sping, see http://sping.rubyforge.org
3
-
4
- NOTE: Change this information in PostInstall.txt
5
- You can also delete it if you don't want it.
6
-
7
-
data/website/index.txt DELETED
@@ -1,83 +0,0 @@
1
- h1. sping
2
-
3
- h1. → 'sping'
4
-
5
-
6
- h2. What
7
-
8
-
9
- h2. Installing
10
-
11
- <pre syntax="ruby">sudo gem install sping</pre>
12
-
13
- h2. The basics
14
-
15
-
16
- h2. Demonstration of usage
17
-
18
-
19
-
20
- h2. Forum
21
-
22
- "http://groups.google.com/group/sping":http://groups.google.com/group/sping
23
-
24
- TODO - create Google Group - sping
25
-
26
- h2. How to submit patches
27
-
28
- Read the "8 steps for fixing other people's code":http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/ and for section "8b: Submit patch to Google Groups":http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/#8b-google-groups, use the Google Group above.
29
-
30
- TODO - pick SVN or Git instructions
31
-
32
- The trunk repository is <code>svn://rubyforge.org/var/svn/sping/trunk</code> for anonymous access.
33
-
34
- OOOORRRR
35
-
36
- You can fetch the source from either:
37
-
38
- <% if rubyforge_project_id %>
39
-
40
- * rubyforge: "http://rubyforge.org/scm/?group_id=<%= rubyforge_project_id %>":http://rubyforge.org/scm/?group_id=<%= rubyforge_project_id %>
41
-
42
- <pre>git clone git://rubyforge.org/sping.git</pre>
43
-
44
- <% else %>
45
-
46
- * rubyforge: MISSING IN ACTION
47
-
48
- TODO - You can not created a RubyForge project, OR have not run <code>rubyforge config</code>
49
- yet to refresh your local rubyforge data with this projects' id information.
50
-
51
- When you do this, this message will magically disappear!
52
-
53
- Or you can hack website/index.txt and make it all go away!!
54
-
55
- <% end %>
56
-
57
- * github: "http://github.com/GITHUB_USERNAME/sping/tree/master":http://github.com/GITHUB_USERNAME/sping/tree/master
58
-
59
- <pre>git clone git://github.com/GITHUB_USERNAME/sping.git</pre>
60
-
61
-
62
- TODO - add "github_username: username" to ~/.rubyforge/user-config.yml and newgem will reuse it for future projects.
63
-
64
-
65
- * gitorious: "git://gitorious.org/sping/mainline.git":git://gitorious.org/sping/mainline.git
66
-
67
- <pre>git clone git://gitorious.org/sping/mainline.git</pre>
68
-
69
- h3. Build and test instructions
70
-
71
- <pre>cd sping
72
- rake test
73
- rake install_gem</pre>
74
-
75
-
76
- h2. License
77
-
78
- This code is free to use under the terms of the MIT license.
79
-
80
- h2. Contact
81
-
82
- Comments are welcome. Send an email to "FIXME full name":mailto:FIXME email via the "forum":http://groups.google.com/group/sping
83
-