docxmerge 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f3e913f4eef6f5d4738bedfbd86911e726b19a889e9c811809c47ec28a5e52ae
4
- data.tar.gz: b03032cb6e864fae9760f19d211c0093d84454bc4d4afb5fee1d187fc59f5ba0
3
+ metadata.gz: a38425370eaecb8fa078001f2b503e65654a06e95e31c000f2a05dce8d2df40d
4
+ data.tar.gz: bc378a5f9a9d3ee664310171eb5e9c590c0f737ec2ec2bf14b6cf37236724674
5
5
  SHA512:
6
- metadata.gz: a793cdd5f7b8eb6068188b670e6ed4d2ce5a7ad34f4a9ee218ef52c74beec5f3887fadb8df68ad5ccc05bc5f7803433986a702946a45652ac754ff0d5580a65a
7
- data.tar.gz: 4b7d50c38bfe5e4a53d2551b9fcd87a625b737fb79a7cbfa8f7678cab8dcb0b549a680206d7f0b337d925a2caf2d16a90c579f162319c03dfa87fadf8b86e61d
6
+ metadata.gz: ad17cc2dc6182e34da41e6729da287f42b432eacdf918a613b75d4f40d52a75da3a44a02c2310aab82bc29a720ce84cc964913f1c063a83a6ebf0f8572ad0a2a
7
+ data.tar.gz: 2e711ce1e7c0f0cd245a506eec42a450af4303e0d812d33f20e4a6ea35588693238c967f627b040a4b3db62f38bc019d2f9a57b8de9a8e89240d61fe90486023
data/.gitignore ADDED
@@ -0,0 +1,8 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /_yardoc/
4
+ /coverage/
5
+ /doc/
6
+ /pkg/
7
+ /spec/reports/
8
+ /tmp/
data/.travis.yml ADDED
@@ -0,0 +1,5 @@
1
+ sudo: false
2
+ language: ruby
3
+ rvm:
4
+ - 2.5.1
5
+ before_install: gem install bundler -v 1.16.1
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at dvp123456@gmail.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,7 @@
1
+ source "https://rubygems.org"
2
+ gem "rest-client"
3
+
4
+ git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
5
+
6
+ # Specify your gem's dependencies in docxmerge.gemspec
7
+ gemspec
data/Gemfile.lock ADDED
@@ -0,0 +1,40 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ docxmerge (0.1.0)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ domain_name (0.5.20190701)
10
+ unf (>= 0.0.5, < 1.0.0)
11
+ http-accept (1.7.0)
12
+ http-cookie (1.0.3)
13
+ domain_name (~> 0.5)
14
+ mime-types (3.3)
15
+ mime-types-data (~> 3.2015)
16
+ mime-types-data (3.2019.0904)
17
+ minitest (5.12.2)
18
+ netrc (0.11.0)
19
+ rake (10.5.0)
20
+ rest-client (2.1.0)
21
+ http-accept (>= 1.7.0, < 2.0)
22
+ http-cookie (>= 1.0.2, < 2.0)
23
+ mime-types (>= 1.16, < 4.0)
24
+ netrc (~> 0.8)
25
+ unf (0.1.4)
26
+ unf_ext
27
+ unf_ext (0.0.7.6)
28
+
29
+ PLATFORMS
30
+ ruby
31
+
32
+ DEPENDENCIES
33
+ bundler (~> 1.16)
34
+ docxmerge!
35
+ minitest (~> 5.0)
36
+ rake (~> 10.0)
37
+ rest-client
38
+
39
+ BUNDLED WITH
40
+ 1.16.1
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2019 dviejo
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md ADDED
@@ -0,0 +1,42 @@
1
+ # Docxmerge
2
+
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/docxmerge`. To experiment with that code, run `bin/console` for an interactive prompt.
4
+
5
+ TODO: Delete this and the text above, and describe your gem
6
+
7
+ ## Installation
8
+
9
+ Add this line to your application's Gemfile:
10
+
11
+ ```ruby
12
+ gem 'docxmerge'
13
+ ```
14
+ And then execute:
15
+
16
+ $ bundle
17
+
18
+ Or install it yourself as:
19
+
20
+ $ gem install docxmerge
21
+
22
+ ## Usage
23
+
24
+ TODO: Write usage instructions here
25
+
26
+ ## Development
27
+
28
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
29
+
30
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
31
+
32
+ ## Contributing
33
+
34
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/docxmerge. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
35
+
36
+ ## License
37
+
38
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
39
+
40
+ ## Code of Conduct
41
+
42
+ Everyone interacting in the Docxmerge project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/docxmerge/blob/master/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << "test"
6
+ t.libs << "lib"
7
+ t.test_files = FileList["test/**/*_test.rb"]
8
+ end
9
+
10
+ task :default => :test
data/bin/console ADDED
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "docxmerge"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start(__FILE__)
data/bin/setup ADDED
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
data/docxmerge.gemspec ADDED
@@ -0,0 +1,36 @@
1
+
2
+ lib = File.expand_path("../lib", __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require "docxmerge/version"
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "docxmerge"
8
+ spec.version = Docxmerge::VERSION
9
+ spec.authors = ["dviejo"]
10
+ spec.email = ["davidviejopomata@gmail.com"]
11
+
12
+ spec.summary = "SDK for docxmerge"
13
+ spec.description = "SDK for docxmerge"
14
+ spec.homepage = "https://docxmerge.com"
15
+ spec.license = "MIT"
16
+
17
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
18
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
19
+ # if spec.respond_to?(:metadata)
20
+ # spec.metadata["allowed_push_host"] = "TODO: Set to 'http://mygemserver.com'"
21
+ # else
22
+ # raise "RubyGems 2.0 or newer is required to protect against " \
23
+ # "public gem pushes."
24
+ # end
25
+
26
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
27
+ f.match(%r{^(test|spec|features|fixtures)/})
28
+ end
29
+ spec.bindir = "exe"
30
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
31
+ spec.require_paths = ["lib"]
32
+
33
+ spec.add_development_dependency "bundler", "~> 1.16"
34
+ spec.add_development_dependency "rake", "~> 10.0"
35
+ spec.add_development_dependency "minitest", "~> 5.0"
36
+ end
data/lib/docxmerge.rb ADDED
@@ -0,0 +1,103 @@
1
+ require "docxmerge/version"
2
+ require 'net/https'
3
+ require 'uri'
4
+ require 'json'
5
+ require 'rest-client'
6
+
7
+ class BadRequestError < StandardError
8
+ end
9
+ module Docxmerge
10
+ # Your code goes here...
11
+ class Docxmerge
12
+ def initialize(api_key, tenant, base_uri)
13
+ @api_key = api_key
14
+ @tenant = tenant || "default"
15
+ @base_uri = base_uri || "https://api.docxmerge.com"
16
+ end
17
+
18
+ def transform_template(template_name)
19
+ uri = "#{@base_uri}/api/v1/Admin/TransformTemplate?template=#{template_name}"
20
+ headers = get_headers()
21
+ response = RestClient.get(uri, headers)
22
+ raise BadRequestError.new unless response.code == 200
23
+ response.bytes
24
+ end
25
+
26
+ def transform_file(file_param)
27
+ uri = "#{@base_uri}/api/v1/Admin/TransformFile"
28
+ response = RestClient.post(uri,
29
+ {
30
+ :multipart => true,
31
+ :file => file_param
32
+ },
33
+ get_headers,
34
+ )
35
+ raise BadRequestError.new unless response.code == 200
36
+ response.bytes
37
+ end
38
+
39
+ def merge_template(template_name, data)
40
+ uri = "#{@base_uri}/api/v1/Admin/MergeTemplate?template=#{template_name}"
41
+ headers = get_headers
42
+ headers["content-type"] = "application/json"
43
+ response = RestClient.post(uri,
44
+ data.to_json,
45
+ headers,
46
+ )
47
+ raise BadRequestError.new unless response.code == 200
48
+ response.bytes
49
+ end
50
+
51
+ def merge_file(file_param, data)
52
+ uri = "#{@base_uri}/api/v1/Admin/MergeFile"
53
+ response = RestClient.post(uri,
54
+ {
55
+ :multipart => true,
56
+ :file => file_param,
57
+ :data => data.to_json
58
+ },
59
+ get_headers,
60
+ )
61
+ raise BadRequestError.new unless response.code == 200
62
+ response.bytes
63
+ end
64
+
65
+
66
+ def transform_and_merge_template(template_name, data)
67
+ uri = "#{@base_uri}/api/v1/Admin/MergeAndTransformTemplatePost?template=#{template_name}"
68
+ headers = get_headers
69
+ headers["content-type"] = "application/json"
70
+ response = RestClient.post(uri,
71
+ data.to_json,
72
+ headers,
73
+ )
74
+ raise BadRequestError.new unless response.code == 200
75
+ response.bytes
76
+ end
77
+
78
+ def transform_and_merge_file(file_param, data)
79
+
80
+ uri = "#{@base_uri}/api/v1/Admin/MergeAndTransform"
81
+ response = RestClient.post(uri,
82
+ {
83
+ :multipart => true,
84
+ :file => file_param,
85
+ :data => data.to_json
86
+ },
87
+ get_headers,
88
+ )
89
+ raise BadRequestError.new unless response.code == 200
90
+ response.bytes
91
+ end
92
+
93
+
94
+ private
95
+
96
+ def get_headers
97
+ {
98
+ "api-key" => @api_key,
99
+ "x-tenant" => @tenant,
100
+ }
101
+ end
102
+ end
103
+ end
@@ -0,0 +1,3 @@
1
+ module Docxmerge
2
+ VERSION = "1.0.1"
3
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: docxmerge
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - dviejo
@@ -59,7 +59,19 @@ executables: []
59
59
  extensions: []
60
60
  extra_rdoc_files: []
61
61
  files:
62
- - fixtures/hello_world.docx
62
+ - ".gitignore"
63
+ - ".travis.yml"
64
+ - CODE_OF_CONDUCT.md
65
+ - Gemfile
66
+ - Gemfile.lock
67
+ - LICENSE.txt
68
+ - README.md
69
+ - Rakefile
70
+ - bin/console
71
+ - bin/setup
72
+ - docxmerge.gemspec
73
+ - lib/docxmerge.rb
74
+ - lib/docxmerge/version.rb
63
75
  homepage: https://docxmerge.com
64
76
  licenses:
65
77
  - MIT
Binary file