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 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/page_import.rb
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), Changshin Lee (http://www.iasandcb.pe.kr)
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
- module Springnote
2
- class Attachment < Base
3
- set_prefix '/pages/:relation_is_part_of/'
1
+ class Springnote::Attachment < Springnote::Base
2
+ set_prefix '/pages/:relation_is_part_of/'
3
+ include Springnote::ImportFile
4
4
 
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
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 # module Springnote
12
+ end
@@ -1,5 +1,5 @@
1
1
  module Springnote
2
- VERSION = "0.4.1"
2
+ VERSION = "0.5"
3
3
 
4
4
  class Base < ActiveResource::Base
5
5
  extend ActiveResourceExtension
@@ -1,9 +1,9 @@
1
- module Springnote::PageImport
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
@@ -1,5 +1,3 @@
1
- module Springnote
2
- class Lock < Base
3
- set_prefix '/pages/:relation_is_part_of/'
4
- end
5
- end # module Springnote
1
+ class Springnote::Lock < Springnote::Base
2
+ set_prefix '/pages/:relation_is_part_of/'
3
+ end
@@ -1,4 +1,6 @@
1
- class Springnote::Page < Springnote::Base
1
+ class Springnote::Page < Springnote::Base
2
+ include Springnote::ImportFile
3
+
2
4
  def self.with_tags(tags, params = {})
3
5
  find(:all, :params => prarams.reverse_merge(:tags => tags))
4
6
  end
@@ -1,5 +1,3 @@
1
- module Springnote
2
- class Revision < Base
3
- set_prefix '/pages/:relation_is_part_of/'
4
- end
5
- end # module Springnote
1
+ class Springnote::Revision < Springnote::Base
2
+ set_prefix '/pages/:relation_is_part_of/'
3
+ end
@@ -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.1
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-18 00:00:00 +09:00
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/page_import.rb
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