glue 1.1.0 → 1.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (6) hide show
  1. data/History.txt +5 -0
  2. data/README.txt +42 -58
  3. data/Rakefile +1 -0
  4. data/lib/glue.rb +11 -13
  5. data/test/test_glue.rb +14 -12
  6. metadata +6 -9
@@ -4,3 +4,8 @@
4
4
 
5
5
  * Birthday!
6
6
 
7
+ === 1.1.1 / 2010-01-29
8
+
9
+ * 1 major enhancement
10
+
11
+ * Fixed Bugs with HTTParty and Glue service
data/README.txt CHANGED
@@ -1,108 +1,92 @@
1
1
  = glue
2
2
 
3
- http://Glue.RubyForge.org
4
-
5
3
  http://GlueNow.com
6
4
 
7
5
  == DESCRIPTION:
8
6
 
9
- The Glue gem enables posting to GlueNow.com API service using an account subdomain, username, password. In this version you can add a post by providing a title, body, optional author name and optional private settings. You can also access some basic info about a users account and check if their account info is valid.
10
-
11
- You can also request public posts from an account using the same RSS that powers the many Glue feeds.
7
+ The Glue gem enables posting to GlueNow.com API service using an account subdomain, username, password. In this version you can add a post by providing a title and body. You can access some basic info about a users account and check if their account info is valid and request public posts from an account using the same RSS that powers many of the Glue feeds.
12
8
 
13
9
  == FEATURES/PROBLEMS:
14
10
 
15
- * To Add a new post Title & Body text must be included
16
- * Access info about an account with successful login:
17
- * Email Address
18
- * If they are an admin
19
- * Thier Author Name
20
- * Can check if a subdomain is valid and belongs to an account
21
- * Read all public posts
22
- * This Gem is throughly tested
23
- * Adding & Reading posts Only at this time
24
- * You can't editor delete a posts yet
25
- * No way to verify if a post has accepted the author name yet
26
11
 
12
+ Adding new posts requires Title & Body text
13
+ Access info about an account with successful login:
14
+ * Email Address
15
+ * If they are an admin
16
+ * Their Author Name
17
+ Check a subdomain is valid and belongs to an account
18
+ Read all public posts
19
+ Gem is thoroughly tested
20
+ Only allows Adding & Reading posts at this time
21
+ You can't edit or delete posts
27
22
 
28
- == SYNOPSIS:
29
23
 
30
- ---- Adding Posts ----
24
+ == SYNOPSIS:
31
25
 
32
- 1. Instantiate your account
26
+ TO ADD A POST USING THE GLUENOW.COM API
33
27
 
34
- * Provide the subdomain, username and password for http://Your-Account.GlueNow.com
28
+ 1. Instantiate your account - Provide subdomain, username and password of http://Your-Subdomain.GlueNow.com Account
35
29
 
36
- account = Glue::API.new( "your-account", "j-username", "j-password" )
30
+ account = Glue::API.new("your-subdomain", "your-username", "your-password")
37
31
 
38
- 2. Check if the account subdomain is valid
32
+ 2. Check if the account subdomain is valid
39
33
 
40
34
  account.valid_site?
41
35
 
42
- 3. Get more info about the user's account
36
+ 3. Get more info about the user's account
43
37
 
44
- response = account.user_info
38
+ user = account.user_info
45
39
 
46
- response #=> {"rsp"=>{"user"=>{"author"=>"Jordan Dobson","admin"=>"true","email"=>"jordandobson@gmail.com"},"stat"=>"ok"}}
40
+ user #=> {"rsp"=>{"user"=>{"author"=>"Jordan Dobson","admin"=>"true","email"=>"jordandobson@gmail.com"},"stat"=>"ok"}}
47
41
 
48
- 4. Post your Content
49
-
50
- * Both Title and Body are required - Set to a variable to check the response
51
-
52
- response = account.post("My Title", "My Body")
53
-
54
- * You can also choose to set the post as private and/or use the optional Author Name
55
- * In this example we set false for not private and true to use the author name
42
+ 4. Post Your Content - Title & Body are required
56
43
 
57
- response = account.post("My Title", "My Body", false, true)
44
+ response = account.post("My Title", "Body Text")
58
45
 
46
+ 5. Receive a Success or Error Hash
59
47
 
60
- 5. Get a success or error hash back
61
-
62
- * A Successful response would look like this
48
+ SUCCESS
63
49
 
64
50
  response #=> {"rsp"=>{"post"=>{"title"=>"My Title","url"=>"http://bit.ly/sakIM","id"=>"14415","longurl"=>"http://jordandobson.com"},"stat"=>"ok"}}
65
51
 
66
- * A Error response would be empty like this
52
+ ERROR
67
53
 
68
54
  response #=> {}
69
-
70
- ---- Reading Posts ----
71
55
 
72
- 1. Instantiate your Reader with your account info
73
-
74
- * Provide the subdomain for http://Your-Account.GlueNow.com
56
+
57
+ TO READ POSTS USING GLUENOW.COM RSS
58
+
59
+ 1. Instantiate your Reader with your account info - Provide subdomain for http://Your-Subdomain.GlueNow.com Account
75
60
 
76
- account = Glue::RSS.new( "your-account" )
61
+ account = Glue::RSS.new("your-account")
77
62
 
78
- 2. Request posts from the RSS feed
79
-
80
- * If you want all of them don't include any limiting or range. Defaults to up to 999 posts on one page
63
+ 2. Request posts from the RSS feed - Include an optional limit & page view for paging
81
64
 
82
- response = account.feed
65
+ all_the_posts = account.feed
83
66
 
84
- * If you want to limit the results include a limit (1-999) and which page (used for paging)
67
+ OR
85
68
 
86
- response = account.feed(10, 3)
69
+ limited_posts = account.feed(10, 3)
87
70
 
88
- 3. Get an RSS feed back or HTML page - These Examples are simplified to include most important nodes
71
+ 3. Receive a Success or Error Hash - Example is simplified to include important nodes
89
72
 
90
- * A successful RSS response would look like
73
+ SUCCESS
91
74
 
92
- response #=> {"rss"=>{"channel"=>{"item"=>{"pubDate"=>"Fri, 12 Sep 2008 00:00:00 +0000","title"=>"My Title","guid"=>"http://jordandobson.com#14415","dc:creator"=>"Jordan","description"=>"<p>My Body</p>","link"=>"http://jordandobson.com","source"=>"Glue"}}}}
75
+ all_the_posts #=> {"rss"=>{"channel"=>{"item"=>{"pubDate"=>"Fri, 12 Sep 2008 00:00:00 +0000","title"=>"My Title","guid"=>"http://jordandobson.com#14415","dc:creator"=>"Jordan","description"=>"<p>Body Text</p>","link"=>"http://jordandobson.com","source"=>"Glue"}}}}
93
76
 
94
- * A failed HTML responsed would look like
77
+ ERROR
95
78
 
96
- response #=> {"html"=>{"head"=>{"title"=>"GLUE | Web + Mobile Content Publishing"},"body"=>"<p>Webpage Body</p>"}}
79
+ all_the_posts #=> {}
80
+
81
+
97
82
 
98
83
  == REQUIREMENTS:
99
84
 
100
- * Nokogiri & HTTParty
101
- * Mocha (for tests)
85
+ HTTParty
102
86
 
103
87
  == INSTALL:
104
88
 
105
- * sudo gem install glue
89
+ sudo gem install glue
106
90
 
107
91
  == LICENSE:
108
92
 
data/Rakefile CHANGED
@@ -7,6 +7,7 @@ require './lib/glue.rb'
7
7
  Hoe.new('glue', Glue::VERSION) do |p|
8
8
  # p.rubyforge_name = 'gluex' # if different than lowercase project name
9
9
  p.developer('Jordan Dobson', 'jordan.dobson@madebysquad.com')
10
+ p.extra_deps = ['nokogiri']
10
11
  p.extra_deps = ['httparty']
11
12
  p.extra_dev_deps = ['mocha']
12
13
  p.remote_rdoc_dir = '' # Release to root
@@ -4,7 +4,7 @@ require 'open-uri'
4
4
 
5
5
  module Glue
6
6
 
7
- VERSION = '1.1.0'
7
+ VERSION = '1.1.1'
8
8
  DOMAIN = 'gluenow.com'
9
9
 
10
10
  class AuthError < StandardError; end
@@ -30,27 +30,25 @@ module Glue
30
30
  end
31
31
 
32
32
  def user_info
33
- response = self.class.post(
33
+ response = self.class.get(
34
34
  USER,
35
- :query => {},
36
- :basic_auth => @auth
35
+ { :basic_auth => @auth }
37
36
  )
38
37
  response['rsp'] ? response : {}
39
-
40
38
  end
41
39
 
42
40
  def post title, body, *opts
43
- response = self.class.post(
41
+ response = self.class.get(
44
42
  POST,
45
- :query => {
46
- :title => title,
47
- :body => body,
48
- :draft => opts.include?( :draft ) ,
49
- :author => opts.include?( :author ) },
50
- :basic_auth => @auth
43
+ { :query => {
44
+ :title => title,
45
+ :body => body,
46
+ :draft => opts.include?( :draft ) ,
47
+ :author => opts.include?( :author ) },
48
+ :basic_auth => @auth
49
+ }
51
50
  )
52
51
  response['rsp'] ? response : {}
53
-
54
52
  end
55
53
 
56
54
  private
@@ -5,6 +5,7 @@ require "mocha"
5
5
  class TestGlue < Test::Unit::TestCase
6
6
 
7
7
  def setup
8
+ @badClient = Glue::API.new( "notavalidurl", "fail", "fail" )
8
9
  @subdomain = 'AccountSubDomain'
9
10
  @username = 'Username'
10
11
  @password = 'Password'
@@ -19,7 +20,8 @@ class TestGlue < Test::Unit::TestCase
19
20
  @lurl = "http://jordandobson.com"
20
21
  @guid = "#{@lurl}##{@id}"
21
22
  @guid2 = "#{@lurl}##{@id2}"
22
- @author = "Jordan"
23
+ @author = "Jordan Dobson"
24
+ @email = "jordan.dobson@madebysquad.com"
23
25
 
24
26
  @resp_fail = {}
25
27
  @resp_html = {"html"=>{"head"=>{"title" => "GLUE | Web + Mobile Publishing"}}}
@@ -28,7 +30,7 @@ class TestGlue < Test::Unit::TestCase
28
30
  "user" => {
29
31
  "author" => @author,
30
32
  "admin" => "true" ,
31
- "email" => nil },
33
+ "email" => @email },
32
34
  "stat" => "ok" }}
33
35
 
34
36
  @post_ok = { "rsp" => {
@@ -118,38 +120,38 @@ class TestGlue < Test::Unit::TestCase
118
120
 
119
121
  def test_site_is_valid
120
122
  @client.stubs(:login_page).returns('<html><body id="login"></body></html>')
121
- assert @client.valid_site?
123
+ assert @client.valid_site?
122
124
  end
123
125
 
124
126
  def test_site_is_invalid
125
127
  @client.stubs(:login_page).returns('<html><body></body></html>')
126
- assert !@client.valid_site?
128
+ assert !@badClient.valid_site?
127
129
  end
128
130
 
129
131
  def test_user_info_valid
130
- Glue::API.stubs(:post).returns(@resp_ok)
132
+ Glue::API.stubs(:get).returns(@resp_ok)
131
133
  actual = @client.user_info
132
134
  assert_equal "ok", actual["rsp"]["stat"]
133
135
  assert actual["rsp"]["user"]
134
- assert_equal "Jordan", actual["rsp"]["user"]["author"]
136
+ assert_equal @author, actual["rsp"]["user"]["author"]
135
137
  assert_equal "true", actual["rsp"]["user"]["admin"]
136
- assert_equal nil, actual["rsp"]["user"]["email"]
138
+ assert_equal @email, actual["rsp"]["user"]["email"]
137
139
  end
138
140
 
139
141
  def test_user_info_invalid
140
- Glue::API.stubs(:post).returns(@resp_html)
141
- actual = @client.user_info
142
+ Glue::API.stubs(:get).returns(@resp_html)
143
+ actual = @badClient.user_info
142
144
  assert_equal @resp_fail, actual
143
145
  end
144
146
 
145
147
  def test_bad_post_response
146
- #Glue::API.stubs(:post).returns(@resp_html)
147
- actual = @client.post(@title, @body)
148
+ Glue::API.stubs(:get).returns(@resp_html)
149
+ actual = @badClient.post(@title, @body)
148
150
  assert_equal @resp_fail, actual
149
151
  end
150
152
 
151
153
  def test_good_post_response
152
- Glue::API.stubs(:post).returns(@post_ok)
154
+ Glue::API.stubs(:get).returns(@post_ok)
153
155
  actual = @client.post(@title, @body)
154
156
  assert_equal "ok", actual["rsp"]["stat"]
155
157
  assert actual["rsp"]["post"]
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: glue
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jordan Dobson
@@ -9,7 +9,7 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-08-29 00:00:00 -07:00
12
+ date: 2010-01-29 00:00:00 -08:00
13
13
  default_executable:
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
@@ -40,12 +40,9 @@ dependencies:
40
40
  requirements:
41
41
  - - ">="
42
42
  - !ruby/object:Gem::Version
43
- version: 1.12.2
43
+ version: 2.3.3
44
44
  version:
45
- description: |-
46
- The Glue gem enables posting to GlueNow.com API service using an account subdomain, username, password. In this version you can add a post by providing a title, body, optional author name and optional private settings. You can also access some basic info about a users account and check if their account info is valid.
47
-
48
- You can also request public posts from an account using the same RSS that powers the many Glue feeds.
45
+ description: The Glue gem enables posting to GlueNow.com API service using an account subdomain, username, password. In this version you can add a post by providing a title and body. You can access some basic info about a users account and check if their account info is valid and request public posts from an account using the same RSS that powers many of the Glue feeds.
49
46
  email:
50
47
  - jordan.dobson@madebysquad.com
51
48
  executables: []
@@ -64,7 +61,7 @@ files:
64
61
  - lib/glue.rb
65
62
  - test/test_glue.rb
66
63
  has_rdoc: true
67
- homepage: http://Glue.RubyForge.org
64
+ homepage: http://GlueNow.com
68
65
  licenses: []
69
66
 
70
67
  post_install_message:
@@ -88,7 +85,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
88
85
  requirements: []
89
86
 
90
87
  rubyforge_project: glue
91
- rubygems_version: 1.3.3
88
+ rubygems_version: 1.3.5
92
89
  signing_key:
93
90
  specification_version: 3
94
91
  summary: The Glue gem enables posting to GlueNow.com API service using an account subdomain, username, password