glue 1.0.2 → 1.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +0 -0
- data/Manifest.txt +1 -0
- data/README.txt +2 -2
- data/Rakefile +1 -2
- data/glue.gemspec +42 -0
- data/lib/glue.rb +11 -4
- data/test/test_glue.rb +3 -2
- metadata +5 -4
data/History.txt
CHANGED
File without changes
|
data/Manifest.txt
CHANGED
data/README.txt
CHANGED
@@ -97,12 +97,12 @@ You can also request public posts from an account using the same RSS that powers
|
|
97
97
|
|
98
98
|
== REQUIREMENTS:
|
99
99
|
|
100
|
-
*
|
100
|
+
* Nokogiri & HTTParty
|
101
101
|
* Mocha (for tests)
|
102
102
|
|
103
103
|
== INSTALL:
|
104
104
|
|
105
|
-
* sudo gem install glue
|
105
|
+
* sudo gem install glue
|
106
106
|
|
107
107
|
== LICENSE:
|
108
108
|
|
data/Rakefile
CHANGED
@@ -5,9 +5,8 @@ require 'hoe'
|
|
5
5
|
require './lib/glue.rb'
|
6
6
|
|
7
7
|
Hoe.new('glue', Glue::VERSION) do |p|
|
8
|
-
# p.rubyforge_name = 'gluex' # if different than lowercase project name
|
9
8
|
p.developer('Jordan Dobson', 'jordan.dobson@madebysquad.com')
|
10
|
-
p.extra_deps = ['
|
9
|
+
p.extra_deps = ['nokogiri']
|
11
10
|
p.extra_deps = ['httparty']
|
12
11
|
p.extra_dev_deps = ['mocha']
|
13
12
|
p.remote_rdoc_dir = '' # Release to root
|
data/glue.gemspec
ADDED
@@ -0,0 +1,42 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = %q{glue}
|
5
|
+
s.version = "1.0.5"
|
6
|
+
|
7
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
8
|
+
s.authors = ["Jordan Dobson"]
|
9
|
+
s.date = %q{2009-08-25}
|
10
|
+
s.default_executable = %q{glue}
|
11
|
+
s.description = %q{Enables posting to GlueNow.com API service and reading posts from Glue accounts.}
|
12
|
+
s.email = ["jordan.dobson@madebysquad.com"]
|
13
|
+
s.extra_rdoc_files = ["History.txt", "Manifest.txt", "README.txt"]
|
14
|
+
s.files = ["History.txt", "Manifest.txt", "README.txt", "Rakefile", "lib/glue.rb", "test/test_glue.rb"]
|
15
|
+
s.homepage = %q{http://glue.rubyforge.org}
|
16
|
+
s.post_install_message = %q{Get ready to Glue!}
|
17
|
+
s.rdoc_options = ["--main", "README.txt"]
|
18
|
+
s.require_paths = ["lib"]
|
19
|
+
s.rubyforge_project = %q{glue}
|
20
|
+
s.rubygems_version = %q{1.3.3}
|
21
|
+
s.summary = %q{Enables posting to GlueNow.com API service and reading posts from Glue accounts.}
|
22
|
+
s.test_files = ["test/test_glue.rb"]
|
23
|
+
|
24
|
+
if s.respond_to? :specification_version then
|
25
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
26
|
+
s.specification_version = 3
|
27
|
+
|
28
|
+
if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
|
29
|
+
s.add_runtime_dependency(%q<httparty>, [">= 0"])
|
30
|
+
s.add_development_dependency(%q<mocha>, [">= 0"])
|
31
|
+
s.add_development_dependency(%q<hoe>, [">= 1.12.2"])
|
32
|
+
else
|
33
|
+
s.add_dependency(%q<httparty>, [">= 0"])
|
34
|
+
s.add_dependency(%q<mocha>, [">= 0"])
|
35
|
+
s.add_dependency(%q<hoe>, [">= 1.12.2"])
|
36
|
+
end
|
37
|
+
else
|
38
|
+
s.add_dependency(%q<httparty>, [">= 0"])
|
39
|
+
s.add_dependency(%q<mocha>, [">= 0"])
|
40
|
+
s.add_dependency(%q<hoe>, [">= 1.12.2"])
|
41
|
+
end
|
42
|
+
end
|
data/lib/glue.rb
CHANGED
@@ -1,11 +1,10 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
require 'httparty'
|
3
|
-
require 'nokogiri'
|
4
3
|
require 'open-uri'
|
5
4
|
|
6
5
|
module Glue
|
7
6
|
|
8
|
-
VERSION = '1.0.
|
7
|
+
VERSION = '1.0.5'
|
9
8
|
DOMAIN = 'gluenow.com'
|
10
9
|
|
11
10
|
class AuthError < StandardError; end
|
@@ -15,6 +14,8 @@ module Glue
|
|
15
14
|
|
16
15
|
POST = '/api/post'
|
17
16
|
USER = '/api/user'
|
17
|
+
|
18
|
+
attr_accessor :site
|
18
19
|
|
19
20
|
def initialize subdomain, user, pass
|
20
21
|
raise AuthError, 'Username, Password or Account subdomain is blank.' \
|
@@ -25,7 +26,7 @@ module Glue
|
|
25
26
|
end
|
26
27
|
|
27
28
|
def valid_site?
|
28
|
-
|
29
|
+
login_page.match(/<body[^>]*id=["']login["']/) ? true : false
|
29
30
|
end
|
30
31
|
|
31
32
|
def user_info
|
@@ -43,6 +44,12 @@ module Glue
|
|
43
44
|
:basic_auth => @auth
|
44
45
|
)
|
45
46
|
end
|
47
|
+
|
48
|
+
private
|
49
|
+
|
50
|
+
def login_page
|
51
|
+
open("http://#{@site}").read
|
52
|
+
end
|
46
53
|
|
47
54
|
end
|
48
55
|
|
@@ -61,4 +68,4 @@ module Glue
|
|
61
68
|
|
62
69
|
end
|
63
70
|
|
64
|
-
end
|
71
|
+
end
|
data/test/test_glue.rb
CHANGED
@@ -20,6 +20,7 @@ class TestGlue < Test::Unit::TestCase
|
|
20
20
|
@guid = "#{@lurl}##{@id}"
|
21
21
|
@guid2 = "#{@lurl}##{@id2}"
|
22
22
|
@author = "Jordan"
|
23
|
+
@login_html = '<html><body id="login"></body></html>'
|
23
24
|
|
24
25
|
@resp_fail = {}
|
25
26
|
|
@@ -116,12 +117,12 @@ class TestGlue < Test::Unit::TestCase
|
|
116
117
|
end
|
117
118
|
|
118
119
|
def test_site_is_valid
|
119
|
-
|
120
|
+
@client.stubs(:login_page).returns('<html><body id="login"></body></html>')
|
120
121
|
assert @client.valid_site?
|
121
122
|
end
|
122
123
|
|
123
124
|
def test_site_is_invalid
|
124
|
-
|
125
|
+
@client.stubs(:login_page).returns('<html><body></body></html>')
|
125
126
|
assert !@client.valid_site?
|
126
127
|
end
|
127
128
|
|
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.0.
|
4
|
+
version: 1.0.5
|
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-
|
12
|
+
date: 2009-08-28 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -40,7 +40,7 @@ dependencies:
|
|
40
40
|
requirements:
|
41
41
|
- - ">="
|
42
42
|
- !ruby/object:Gem::Version
|
43
|
-
version:
|
43
|
+
version: 2.3.3
|
44
44
|
version:
|
45
45
|
description: |-
|
46
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.
|
@@ -61,6 +61,7 @@ files:
|
|
61
61
|
- Manifest.txt
|
62
62
|
- README.txt
|
63
63
|
- Rakefile
|
64
|
+
- glue.gemspec
|
64
65
|
- lib/glue.rb
|
65
66
|
- test/test_glue.rb
|
66
67
|
has_rdoc: true
|
@@ -88,7 +89,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
88
89
|
requirements: []
|
89
90
|
|
90
91
|
rubyforge_project: glue
|
91
|
-
rubygems_version: 1.3.
|
92
|
+
rubygems_version: 1.3.4
|
92
93
|
signing_key:
|
93
94
|
specification_version: 3
|
94
95
|
summary: The Glue gem enables posting to GlueNow.com API service using an account subdomain, username, password
|