web_merge 1.0.1 → 1.0.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f9e843644bc9db35f9d1389bea871103ab51bed7
4
- data.tar.gz: 6248fee37e9185572328502f649da3d3c7509157
3
+ metadata.gz: ae95c7b06804d65c4af0658a9d3276a5512c0164
4
+ data.tar.gz: 1ecfc7e14318902e71601e2a93172f383da15ebd
5
5
  SHA512:
6
- metadata.gz: c1288858d31250371f38e56061306375aa0be294c10435e94cdf366cead7c265b9438bfe55e877248112743215f3754b69d08b3917d8683d3f46bfad4eaf5f1b
7
- data.tar.gz: 2ea30ab2cc015612b5f4f9757284700f90ebd7befd77fae0d82202a6fb34740556deb723057ade35c0eb886dbb7231f7a28ebb5b00dd6ab1c7f4d8ff5d4129fd
6
+ metadata.gz: 03bcccc868d80c9a65c4cb052c33d6c2e3a78e980fb40ddf3a618ee7f439e3c24a7d6f2472e3845898fd53449ac498229891cb356d309d3e1c3491e6860c1a66
7
+ data.tar.gz: 7bc9f2ae4c2431ed0fffea3a47781fb7eeb1e695f190b9ad4e631ede4cd3ea6c435a378919e1807efaaac649c33671a6cd73071c41126650c2aec101f2ec9de5
data/CHANGELOG.md CHANGED
@@ -1,10 +1,13 @@
1
- ## 1.0.1
1
+ ## 1.0.2
2
2
 
3
3
  * Update regex for single line match.
4
+
5
+ ## 1.0.1
6
+
4
7
  * Add flatten option to request params.
5
8
  * Don't require file_path for update
6
9
  * Ability to Pass Options To Create Merge Document
7
10
 
8
11
  ## 1.0.0
9
12
 
10
- * Initial release
13
+ * Initial release
data/lib/web_merge/api.rb CHANGED
@@ -46,9 +46,15 @@ module WebMerge
46
46
  # default: false.
47
47
  # options[:download] Will return the merged document in response
48
48
  # default: false
49
+ # options[:flatten] Will return the merged document flattened (with no editing capabilities)
50
+ # default: 0
49
51
  #
50
52
  def merge_document(doc_id, doc_key, field_mappings, options = {}, &block)
51
- post("#{WebMerge::Constants::MERGE_ENDPOINT}/#{doc_id}/#{doc_key}?download=#{download(options)}&test=#{test(options)}", field_mappings, &block)
53
+ query = ""
54
+ if options.present?
55
+ query = "?" + URI.encode(options.map{|k,v| "#{k}=#{v}"}.join("&"))
56
+ end
57
+ post("#{WebMerge::Constants::MERGE_ENDPOINT}/#{doc_id}/#{doc_key}#{query}", field_mappings, &block)
52
58
  end
53
59
 
54
60
  #
@@ -2,11 +2,11 @@ module WebMerge
2
2
  class Document
3
3
  include ::ActiveModel::Validations
4
4
 
5
- attr_accessor :name, :type, :output, :output_name, :size_width, :size_height, :notification, :file_path
5
+ attr_accessor :name, :type, :flatten, :output, :output_name, :size_width, :size_height, :notification, :file_path
6
6
  attr_reader :id, :key, :size, :active, :url
7
7
 
8
8
  validates_presence_of :name, :type, :output
9
- validates_presence_of :file_path
9
+ validates_presence_of :file_path, :on => :create
10
10
  validates :type, inclusion: { in: WebMerge::Constants::SUPPORTED_TYPES }
11
11
  validates :output, inclusion: { in: WebMerge::Constants::SUPPORTED_OUTPUTS }
12
12
 
@@ -97,11 +97,14 @@ module WebMerge
97
97
  type: type,
98
98
  output: output
99
99
  }
100
+
101
+ request_params["settings[flatten]"] = flatten if flatten
102
+
100
103
  [:output_name, :size_width, :size_height].each do |key|
101
104
  value = send(key)
102
105
  request_params.merge!(key => value) if value.present?
103
106
  end
104
- merge_file_contents!(request_params)
107
+ merge_file_contents!(request_params) if file_path.present?
105
108
  merge_notification!(request_params) if notification.present?
106
109
  request_params
107
110
  end
@@ -5,7 +5,7 @@ module WebMerge
5
5
  attr_accessor :to, :from, :subject, :html, :security, :password
6
6
 
7
7
  validates_presence_of :to, :from
8
- validates_format_of :to, :from, :with => /^(|(([A-Za-z0-9]+_+)|([A-Za-z0-9]+\-+)|([A-Za-z0-9]+\.+)|([A-Za-z0-9]+\++))*[A-Za-z0-9]+@((\w+\-+)|(\w+\.))*\w{1,63}\.[a-zA-Z]{2,6})$/i
8
+ validates_format_of :to, :from, :with => /\A(|(([A-Za-z0-9]+_+)|([A-Za-z0-9]+\-+)|([A-Za-z0-9]+\.+)|([A-Za-z0-9]+\++))*[A-Za-z0-9]+@((\w+\-+)|(\w+\.))*\w{1,63}\.[a-zA-Z]{2,6})\z/i
9
9
  validates_presence_of :password, if: :requires_password?
10
10
  validates :security, inclusion: { in: WebMerge::Constants::SECURITY_LEVELS }
11
11
 
@@ -1,3 +1,3 @@
1
1
  module WebMerge
2
- VERSION = "1.0.1"
2
+ VERSION = "1.0.2"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: web_merge
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.0.2
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-10-19 00:00:00.000000000 Z
11
+ date: 2016-05-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -92,7 +92,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
92
92
  version: '0'
93
93
  requirements: []
94
94
  rubyforge_project:
95
- rubygems_version: 2.4.3
95
+ rubygems_version: 2.4.8
96
96
  signing_key:
97
97
  specification_version: 4
98
98
  summary: WebMerge REST API Wrapper