confluency 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 47eebce1e13ce2437c98fd143aadcd60040f2a81
4
- data.tar.gz: 49342db0d644bc2fe3697b244070da9f21a4b4c3
3
+ metadata.gz: e3652c5ffe7813bbe9b5764072fdc788a4d0e0f7
4
+ data.tar.gz: 69a089300e7eff359531b2a806224ed2ceed5a55
5
5
  SHA512:
6
- metadata.gz: 6b867af9717cc23e0a882b5b40eded3ea210da4662fc075a728b03213c6502635938f2db86be3962d2944aea710519d72f32b5f576feb2628ed0e326ce337ac9
7
- data.tar.gz: 7ebb91a4f6008e5d1256b72d5372e212c310e26b21632f24928ccc8c2c39152ac8ebbc352185a2b13e6ba78137e2c96409cbf13956597730b982fcb5f8a56851
6
+ metadata.gz: 04ec95230a43e2e8acb9519dcf45de633e43610615e3452132c025e42972432ddfa88ab7cd50f9d951545eb0d61079df0cc1fbc540da47a9ef9d1bd0d355a595
7
+ data.tar.gz: 4327fd19c8b6203c0998f1ed5ff471e84904be1243f8ed7e848b43009938e8c96f7d2505733fc152c5ebe64f4d0130f5bb6b960936bfb9607c20f186cdc8aeb3
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format progress
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Confluency
2
2
 
3
- TODO: Write a gem description
3
+ Confluency serves as a client to connect to Confluence and treats you to some easy helper methods to format text for to meet [Confluence's storage format](https://confluence.atlassian.com/display/DOC/Confluence+Storage+Format)
4
4
 
5
5
  ## Installation
6
6
 
@@ -18,7 +18,26 @@ Or install it yourself as:
18
18
 
19
19
  ## Usage
20
20
 
21
- TODO: Write usage instructions here
21
+ To Connect
22
+ ----------
23
+
24
+ client = Confluency::Client.new("CONFLUENCE_URL")
25
+ client.login("user","password")
26
+
27
+ Remote Methods
28
+ --------------
29
+
30
+ These will allow you to do things to administer Confluence, i.e. Add spaces, change permissions, delete pages, etc.
31
+
32
+ For a list of valid remote methods, please see [Confluence's list of remote methods](https://developer.atlassian.com/display/CONFDEV/Remote+Confluence+Methods) and note that the token can be ommited. The Confluency client already passes the token into the method.
33
+
34
+ Helper Methods
35
+ --------------
36
+
37
+ These helper methods are intended to make formating document easier from you application.
38
+
39
+ # String#to_heading
40
+ "HELLO".to_heading(3) # => <h3>HELLO</h3>
22
41
 
23
42
  ## Contributing
24
43
 
@@ -20,4 +20,5 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.add_development_dependency "bundler", "~> 1.3"
22
22
  spec.add_development_dependency "rake"
23
+ spec.add_development_dependency 'rspec'
23
24
  end
@@ -1,5 +1,6 @@
1
1
  require "confluency/version"
2
2
  require "confluency/client"
3
+ require "confluency/string"
3
4
 
4
5
  module Confluency
5
6
  # your code here
@@ -2,16 +2,17 @@ require 'xmlrpc/client'
2
2
 
3
3
  module Confluency
4
4
  class Client
5
- def initialize(url)
6
- url += "/rpc/xmlrpc" unless url[-11..-1] == "/rpc/xmlrpc"
7
- @url = url
8
- server = XMLRPC::Client.new2(url)
9
- @conf = server.proxy("confluence2")
10
- @token = "12345"
11
- end
12
-
13
- def login(username, password)
14
- @user = username
5
+
6
+ def initialize(server_url)
7
+ server_url += "/rpc/xmlrpc" unless server_url[-11..-1] == "/rpc/xmlrpc"
8
+ @server_url = server_url
9
+ server = XMLRPC::Client.new2(server_url)
10
+ @conf = server.proxy("confluence2")
11
+ @token = "12345"
12
+ end
13
+
14
+ def login(username, password)
15
+ @user = username
15
16
  @pass = password
16
17
  do_login()
17
18
  end
@@ -38,5 +39,5 @@ module Confluency
38
39
  raise e.faultString
39
40
  end
40
41
  end
41
- end
42
- end
42
+ end
43
+ end
@@ -0,0 +1,5 @@
1
+ class String
2
+ def to_heading(num)
3
+ "<h#{num.to_s}>#{self}</h#{num.to_s}>"
4
+ end
5
+ end
@@ -1,3 +1,3 @@
1
1
  module Confluency
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
@@ -0,0 +1,16 @@
1
+ require 'spec_helper'
2
+ require 'confluency'
3
+
4
+ describe Confluency::Client, '#new' do
5
+
6
+ before :each do
7
+ url = 'http://localhost'
8
+ @client = Confluency::Client.new(url)
9
+ end
10
+
11
+ it "should not raise an error" do
12
+ username = 'admin'
13
+ password = 'password'
14
+ @client.login(username,password)
15
+ end
16
+ end
@@ -0,0 +1,17 @@
1
+ # This file was generated by the `rspec --init` command. Conventionally, all
2
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
+ # Require this file using `require "spec_helper"` to ensure that it is only
4
+ # loaded once.
5
+ #
6
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
7
+ RSpec.configure do |config|
8
+ config.treat_symbols_as_metadata_keys_with_true_values = true
9
+ config.run_all_when_everything_filtered = true
10
+ config.filter_run :focus
11
+
12
+ # Run specs in random order to surface order dependencies. If you find an
13
+ # order dependency and want to debug it, you can fix the order by providing
14
+ # the seed, which is printed after each run.
15
+ # --seed 1234
16
+ config.order = 'random'
17
+ end
@@ -0,0 +1,18 @@
1
+ require 'spec_helper'
2
+ require 'confluency'
3
+
4
+ describe String, "#to_heading" do
5
+
6
+ before :each do
7
+ @string = "This is my string"
8
+ end
9
+
10
+ it "should return a string as a head element" do
11
+ @string.to_heading(1).should == "<h1>#{@string}</h1>"
12
+ end
13
+
14
+ it "should return an <h3> if 3 is passed to to_heading" do
15
+ @string.to_heading(3).should == "<h3>#{@string}</h3>"
16
+ end
17
+
18
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: confluency
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nate West
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-04-02 00:00:00.000000000 Z
11
+ date: 2013-04-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - '>='
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
41
55
  description: Confluency is a magical Ruby gem that's fluent in Confluence markup
42
56
  email:
43
57
  - natescott.west@gmail.com
@@ -46,6 +60,7 @@ extensions: []
46
60
  extra_rdoc_files: []
47
61
  files:
48
62
  - .gitignore
63
+ - .rspec
49
64
  - Gemfile
50
65
  - LICENSE.txt
51
66
  - README.md
@@ -53,7 +68,11 @@ files:
53
68
  - confluency.gemspec
54
69
  - lib/confluency.rb
55
70
  - lib/confluency/client.rb
71
+ - lib/confluency/string.rb
56
72
  - lib/confluency/version.rb
73
+ - spec/client_spec.rb
74
+ - spec/spec_helper.rb
75
+ - spec/string_spec.rb
57
76
  homepage: http://github.com/drumsrgr8forn8/confluency
58
77
  licenses:
59
78
  - MIT
@@ -78,4 +97,7 @@ rubygems_version: 2.0.0
78
97
  signing_key:
79
98
  specification_version: 4
80
99
  summary: Confluency will allow you to write to Confluence from another application
81
- test_files: []
100
+ test_files:
101
+ - spec/client_spec.rb
102
+ - spec/spec_helper.rb
103
+ - spec/string_spec.rb