springnote_resources 0.4.1 → 0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History.txt +6 -0
- data/Manifest.txt +1 -1
- data/README.txt +1 -1
- data/lib/springnote/attachment.rb +10 -11
- data/lib/springnote/base.rb +1 -1
- data/lib/springnote/{page_import.rb → import_file.rb} +5 -8
- data/lib/springnote/lock.rb +3 -5
- data/lib/springnote/page.rb +3 -1
- data/lib/springnote/revision.rb +3 -5
- data/lib/springnote_resources.rb +2 -1
- metadata +3 -3
data/History.txt
CHANGED
@@ -1,3 +1,9 @@
|
|
1
|
+
== 0.5 / 2008-1-21
|
2
|
+
* ImportFile module was inclueded by File and Attachment. You can use like following code:
|
3
|
+
|
4
|
+
page = Springnote::Page.import_file(path)
|
5
|
+
attachment = Springnote::Attachment.import_file(path, :relation_is_part_of => page.id)
|
6
|
+
|
1
7
|
== 0.4.1 / 2008-1-19
|
2
8
|
* common parameter's name was changed from _domain to domain(without underbar).
|
3
9
|
|
data/Manifest.txt
CHANGED
@@ -11,7 +11,7 @@ lib/springnote/base.rb
|
|
11
11
|
lib/springnote/configuration.rb
|
12
12
|
lib/springnote/lock.rb
|
13
13
|
lib/springnote/page.rb
|
14
|
-
lib/springnote/
|
14
|
+
lib/springnote/import_file.rb
|
15
15
|
lib/springnote/revision.rb
|
16
16
|
lib/exts/active_resource_extension.rb
|
17
17
|
lib/exts/common_parameters.rb
|
data/README.txt
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
= Springnote Resources
|
2
2
|
|
3
3
|
* Homepage: http://myruby.net/pages/391111
|
4
|
-
* Author: Bryan Kang (http://myruby.net)
|
4
|
+
* Author: Bryan Kang (http://myruby.net) and Changshin Lee (http://www.iasandcb.pe.kr)
|
5
5
|
|
6
6
|
== DESCRIPTIONS:
|
7
7
|
|
@@ -1,13 +1,12 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
1
|
+
class Springnote::Attachment < Springnote::Base
|
2
|
+
set_prefix '/pages/:relation_is_part_of/'
|
3
|
+
include Springnote::ImportFile
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
end
|
5
|
+
def source
|
6
|
+
http = Net::HTTP.new(Springnote::Configuration::SERVER_URL, 80)
|
7
|
+
req = Net::HTTP::Get.new(element_path[0..-5])
|
8
|
+
req.basic_auth(Springnote::Base.site.user, Springnote::Base.site.password)
|
9
|
+
response = http.request(req)
|
10
|
+
response.body
|
12
11
|
end
|
13
|
-
end
|
12
|
+
end
|
data/lib/springnote/base.rb
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
module Springnote::
|
1
|
+
module Springnote::ImportFile
|
2
2
|
BOUNDARY = 'AaB03x'
|
3
3
|
|
4
4
|
module ClassMethod
|
5
|
-
def import_file(path)
|
6
|
-
new.import_file(path)
|
5
|
+
def import_file(path, opts = {})
|
6
|
+
new(opts).import_file(path)
|
7
7
|
end
|
8
8
|
end
|
9
9
|
|
@@ -16,7 +16,7 @@ module Springnote::PageImport
|
|
16
16
|
'Content-Type' => "multipart/form-data; boundary=#{BOUNDARY}"
|
17
17
|
|
18
18
|
returning connection.post(collection_path, body, headers) do |response|
|
19
|
-
self.id = id_from_response(response)
|
19
|
+
# self.id = id_from_response(response)
|
20
20
|
load_attributes_from_response(response)
|
21
21
|
end
|
22
22
|
self
|
@@ -25,7 +25,6 @@ module Springnote::PageImport
|
|
25
25
|
def self.included(base)
|
26
26
|
base.extend(ClassMethod)
|
27
27
|
end
|
28
|
-
|
29
28
|
|
30
29
|
protected
|
31
30
|
# COPY from ruby/facets 1.8.54
|
@@ -54,6 +53,4 @@ protected
|
|
54
53
|
end
|
55
54
|
}.join('') + "--#{boundary}--\r\n"
|
56
55
|
end
|
57
|
-
end
|
58
|
-
|
59
|
-
Springnote::Page.send :include, Springnote::PageImport
|
56
|
+
end
|
data/lib/springnote/lock.rb
CHANGED
data/lib/springnote/page.rb
CHANGED
data/lib/springnote/revision.rb
CHANGED
data/lib/springnote_resources.rb
CHANGED
@@ -18,8 +18,9 @@ require 'exts/active_resource_extension'
|
|
18
18
|
# Springnote's resources
|
19
19
|
require 'springnote/configuration'
|
20
20
|
require 'springnote/base'
|
21
|
+
require 'springnote/import_file'
|
22
|
+
|
21
23
|
require 'springnote/page'
|
22
24
|
require 'springnote/attachment'
|
23
25
|
require 'springnote/lock'
|
24
26
|
require 'springnote/revision'
|
25
|
-
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: springnote_resources
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: "0.5"
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bryan Kang
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2008-01-
|
12
|
+
date: 2008-01-21 00:00:00 +09:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
@@ -47,7 +47,7 @@ files:
|
|
47
47
|
- lib/springnote/configuration.rb
|
48
48
|
- lib/springnote/lock.rb
|
49
49
|
- lib/springnote/page.rb
|
50
|
-
- lib/springnote/
|
50
|
+
- lib/springnote/import_file.rb
|
51
51
|
- lib/springnote/revision.rb
|
52
52
|
- lib/exts/active_resource_extension.rb
|
53
53
|
- lib/exts/common_parameters.rb
|