relaxo-model 0.4.1 → 0.4.2

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: 44f11570609589c888e40f305a664aa537818a89
4
- data.tar.gz: a3b2fb07a3f52c10bb4e9bdb399e6276c33584d5
3
+ metadata.gz: 0d01f7934c43e5cbd4deac4323fb90a35156a720
4
+ data.tar.gz: 67027d9c7392ae4a64fe1ed33640157166d803b0
5
5
  SHA512:
6
- metadata.gz: bfb74b336947a27ef3f629aae18fb5fa715aaa1ea850e8efeb49315e2974131784d9f411e8aed19f4e9c3de30b24f8e3302b05b59cd910443389b53857cb74f3
7
- data.tar.gz: e7e504bae3167ce7d62ecefbf674134e68ab63feb906917bb35f64c4c628e237927d9e1ebde6bf0161407b93a00c79dab94598fb093b5b5d10ec2334c6d170b2
6
+ metadata.gz: 79251d1564d2bba11040177cdff7b6ed9be0eff352bbb943c7ad3b888c682e2d1b5001b29db7b32f756c5b3f567014981d7a8ad7375aa1040720a1ea992bd432
7
+ data.tar.gz: 6364a2e45d27ce2eb1e64e2bce5baf361b9a6da5ce0b9a77bc452f1be93729d52f8f41fbd56ddaff312aadd18c0d2786fa988781ffad6904914b72579fdf1f95
@@ -0,0 +1,49 @@
1
+ # Copyright (c) 2013 Samuel G. D. Williams. <http://www.oriontransfer.co.nz>
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ # of this software and associated documentation files (the "Software"), to deal
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in
11
+ # all copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ # THE SOFTWARE.
20
+
21
+ require 'relaxo/attachments'
22
+ require 'relaxo/model/component'
23
+
24
+ module Relaxo
25
+ module Model
26
+ module Component
27
+ ATTACHMENTS = '_attachments'
28
+ DEFAULT_ATTACHMENT_CONTENT_TYPE = 'application/octet-stream'
29
+
30
+ # Attach a file to the document with a given path.
31
+ def attach(path, data, options = {})
32
+ options[:content_type] ||= DEFAULT_ATTACHMENT_CONTENT_TYPE
33
+
34
+ @database.attach(@attributes, path, data, options)
35
+ end
36
+
37
+ # Get all attachments, optionally filtering with a particular prefix path.
38
+ def attachments(prefix = nil)
39
+ all_attachments = (@attributes[ATTACHMENTS] || [])
40
+
41
+ if prefix
42
+ all_attachments.select{|name, attachment| name.start_with? prefix}
43
+ else
44
+ all_attachments
45
+ end
46
+ end
47
+ end
48
+ end
49
+ end
@@ -20,6 +20,6 @@
20
20
 
21
21
  module Relaxo
22
22
  module Model
23
- VERSION = "0.4.1"
23
+ VERSION = "0.4.2"
24
24
  end
25
25
  end
metadata CHANGED
@@ -1,55 +1,55 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: relaxo-model
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-08-05 00:00:00.000000000 Z
11
+ date: 2015-04-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.3'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.3'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: relaxo
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: 0.4.0
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: 0.4.0
55
55
  description: "\t\tRelaxo Model provides a framework for business logic on top of\n\t\tRelaxo/CouchDB.
@@ -64,6 +64,7 @@ files:
64
64
  - Gemfile
65
65
  - README.md
66
66
  - lib/relaxo/model.rb
67
+ - lib/relaxo/model/attachments.rb
67
68
  - lib/relaxo/model/base.rb
68
69
  - lib/relaxo/model/component.rb
69
70
  - lib/relaxo/model/document.rb
@@ -87,17 +88,17 @@ require_paths:
87
88
  - lib
88
89
  required_ruby_version: !ruby/object:Gem::Requirement
89
90
  requirements:
90
- - - '>='
91
+ - - ">="
91
92
  - !ruby/object:Gem::Version
92
93
  version: '0'
93
94
  required_rubygems_version: !ruby/object:Gem::Requirement
94
95
  requirements:
95
- - - '>='
96
+ - - ">="
96
97
  - !ruby/object:Gem::Version
97
98
  version: '0'
98
99
  requirements: []
99
100
  rubyforge_project:
100
- rubygems_version: 2.0.6
101
+ rubygems_version: 2.2.2
101
102
  signing_key:
102
103
  specification_version: 4
103
104
  summary: A model layer for CouchDB with minimal global state.