web_merge 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/lib/web_merge/document.rb +9 -8
- data/lib/web_merge/version.rb +1 -1
- metadata +13 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f9e843644bc9db35f9d1389bea871103ab51bed7
|
4
|
+
data.tar.gz: 6248fee37e9185572328502f649da3d3c7509157
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c1288858d31250371f38e56061306375aa0be294c10435e94cdf366cead7c265b9438bfe55e877248112743215f3754b69d08b3917d8683d3f46bfad4eaf5f1b
|
7
|
+
data.tar.gz: 2ea30ab2cc015612b5f4f9757284700f90ebd7befd77fae0d82202a6fb34740556deb723057ade35c0eb886dbb7231f7a28ebb5b00dd6ab1c7f4d8ff5d4129fd
|
data/CHANGELOG.md
ADDED
data/lib/web_merge/document.rb
CHANGED
@@ -10,7 +10,8 @@ module WebMerge
|
|
10
10
|
validates :type, inclusion: { in: WebMerge::Constants::SUPPORTED_TYPES }
|
11
11
|
validates :output, inclusion: { in: WebMerge::Constants::SUPPORTED_OUTPUTS }
|
12
12
|
|
13
|
-
def initialize(name: required(:name), type: required(:type), output: WebMerge::Constants::PDF, file_path: nil, options: {})
|
13
|
+
def initialize(client: required(:client), name: required(:name), type: required(:type), output: WebMerge::Constants::PDF, file_path: nil, options: {})
|
14
|
+
@client = client
|
14
15
|
@name = name
|
15
16
|
@type = type
|
16
17
|
@output = output
|
@@ -33,7 +34,7 @@ module WebMerge
|
|
33
34
|
end
|
34
35
|
|
35
36
|
def self.all
|
36
|
-
|
37
|
+
@client.get_documents.map do |doc_hash|
|
37
38
|
instance = empty_instance
|
38
39
|
instance.send(:update_instance, doc_hash)
|
39
40
|
instance
|
@@ -51,9 +52,9 @@ module WebMerge
|
|
51
52
|
def save
|
52
53
|
return false unless valid?
|
53
54
|
response = if new_document?
|
54
|
-
|
55
|
+
@client.create_document(as_form_data)
|
55
56
|
else
|
56
|
-
|
57
|
+
@client.update_document(id, as_form_data)
|
57
58
|
end
|
58
59
|
update_instance(response.symbolize_keys)
|
59
60
|
true
|
@@ -65,20 +66,20 @@ module WebMerge
|
|
65
66
|
|
66
67
|
def reload
|
67
68
|
raise "Cannot reload a new document, perhaps you'd like to call `save' first?" if new_document?
|
68
|
-
response =
|
69
|
+
response = @client.get_document(id)
|
69
70
|
update_instance(response)
|
70
71
|
self
|
71
72
|
end
|
72
73
|
|
73
74
|
def delete
|
74
75
|
delete = false
|
75
|
-
|
76
|
+
@client.delete_document(id) { |response| delete = JSON(response.body)["success"] } unless new_document?
|
76
77
|
delete
|
77
78
|
end
|
78
79
|
|
79
80
|
def fields
|
80
81
|
raise "Cannot fetch fields for an unpersisted document, perhaps you'd like to call `save' first?" if new_document?
|
81
|
-
@fields ||=
|
82
|
+
@fields ||= @client.get_document_fields(id)
|
82
83
|
end
|
83
84
|
|
84
85
|
def field_names
|
@@ -87,7 +88,7 @@ module WebMerge
|
|
87
88
|
|
88
89
|
def merge(field_mappings, options = {}, &block)
|
89
90
|
raise "Cannot merge an unpersisted document, perhaps you'd like to call `save' first?" if new_document?
|
90
|
-
|
91
|
+
@client.merge_document(id, key, field_mappings, options, &block)
|
91
92
|
end
|
92
93
|
|
93
94
|
def as_form_data
|
data/lib/web_merge/version.rb
CHANGED
metadata
CHANGED
@@ -1,55 +1,55 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: web_merge
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jeremy Clarke
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-10-19 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.7'
|
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.7'
|
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: '10.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: '10.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: activemodel
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '3.0'
|
48
48
|
type: :development
|
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: '3.0'
|
55
55
|
description: Manage and merge Documents using the WebMerge.me REST API
|
@@ -59,7 +59,8 @@ executables: []
|
|
59
59
|
extensions: []
|
60
60
|
extra_rdoc_files: []
|
61
61
|
files:
|
62
|
-
- .gitignore
|
62
|
+
- ".gitignore"
|
63
|
+
- CHANGELOG.md
|
63
64
|
- Gemfile
|
64
65
|
- LICENSE.txt
|
65
66
|
- README.md
|
@@ -81,17 +82,17 @@ require_paths:
|
|
81
82
|
- lib
|
82
83
|
required_ruby_version: !ruby/object:Gem::Requirement
|
83
84
|
requirements:
|
84
|
-
- -
|
85
|
+
- - ">="
|
85
86
|
- !ruby/object:Gem::Version
|
86
87
|
version: '0'
|
87
88
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
88
89
|
requirements:
|
89
|
-
- -
|
90
|
+
- - ">="
|
90
91
|
- !ruby/object:Gem::Version
|
91
92
|
version: '0'
|
92
93
|
requirements: []
|
93
94
|
rubyforge_project:
|
94
|
-
rubygems_version: 2.4.
|
95
|
+
rubygems_version: 2.4.3
|
95
96
|
signing_key:
|
96
97
|
specification_version: 4
|
97
98
|
summary: WebMerge REST API Wrapper
|