Skip to content

Commit acd2fdf

Browse files
author
Laurynas Butkus
committed
Initial import
0 parents  commit acd2fdf

15 files changed

+226
-0
lines changed

.gitignore

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/.bundle/
2+
/.yardoc
3+
/_yardoc/
4+
/coverage/
5+
/doc/
6+
/pkg/
7+
/spec/reports/
8+
/tmp/
9+
10+
# rspec failure tracking
11+
.rspec_status

.rspec

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
--format documentation
2+
--color
3+
--require spec_helper

.ruby-version

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
2.4.1

.travis.yml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
sudo: false
2+
language: ruby
3+
rvm:
4+
- 2.4.1
5+
before_install: gem install bundler -v 1.16.1

Gemfile

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
source "https://rubygems.org"
2+
3+
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4+
5+
# Specify your gem's dependencies in convert_api.gemspec
6+
gemspec

Gemfile.lock

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
PATH
2+
remote: .
3+
specs:
4+
convert_api (0.1.0)
5+
6+
GEM
7+
remote: https://rubygems.org/
8+
specs:
9+
diff-lcs (1.3)
10+
rake (10.5.0)
11+
rspec (3.7.0)
12+
rspec-core (~> 3.7.0)
13+
rspec-expectations (~> 3.7.0)
14+
rspec-mocks (~> 3.7.0)
15+
rspec-core (3.7.1)
16+
rspec-support (~> 3.7.0)
17+
rspec-expectations (3.7.0)
18+
diff-lcs (>= 1.2.0, < 2.0)
19+
rspec-support (~> 3.7.0)
20+
rspec-mocks (3.7.0)
21+
diff-lcs (>= 1.2.0, < 2.0)
22+
rspec-support (~> 3.7.0)
23+
rspec-support (3.7.1)
24+
25+
PLATFORMS
26+
ruby
27+
28+
DEPENDENCIES
29+
bundler (~> 1.16)
30+
convert_api!
31+
rake (~> 10.0)
32+
rspec (~> 3.0)
33+
34+
BUNDLED WITH
35+
1.16.1

LICENSE.txt

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
The MIT License (MIT)
2+
3+
Copyright (c) 2018 Tomas Rutkauskas
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.

README.md

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# ConvertApi
2+
3+
## Installation
4+
5+
Add this line to your application's Gemfile:
6+
7+
```ruby
8+
gem 'convert_api'
9+
```
10+
11+
And then execute:
12+
13+
$ bundle
14+
15+
Or install it yourself as:
16+
17+
$ gem install convert_api
18+
19+
## Usage
20+
21+
TODO: Write usage instructions here
22+
23+
## Development
24+
25+
Run `rake spec` to run the tests.
26+
27+
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).
28+
29+
## Contributing
30+
31+
Bug reports and pull requests are welcome on GitHub at https://github.com/ConvertAPI/convertapi-ruby. 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.
32+
33+
## License
34+
35+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).

Rakefile

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
require 'bundler/gem_tasks'
2+
require 'rspec/core/rake_task'
3+
4+
RSpec::Core::RakeTask.new(:spec)
5+
6+
task :default => :spec

convert_api.gemspec

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
2+
lib = File.expand_path('../lib', __FILE__)
3+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4+
require 'convert_api/version'
5+
6+
Gem::Specification.new do |spec|
7+
spec.name = 'convert_api'
8+
spec.version = ConvertApi::VERSION
9+
spec.authors = ['Tomas Rutkauskas']
10+
spec.email = ['[email protected]']
11+
12+
spec.summary = %q{ConvertAPI client library}
13+
spec.description = %q{Ruby library for Convert API. Creating PDF and images from various sources like Word, Excel, Powerpoint document, images, web pages or raw HTML codes.}
14+
spec.homepage = 'https://github.com/ConvertAPI/convertapi-ruby'
15+
spec.license = 'MIT'
16+
17+
18+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
19+
f.match(%r{^(test|spec|features)/})
20+
end
21+
spec.bindir = 'exe'
22+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
23+
spec.require_paths = ['lib']
24+
25+
spec.add_development_dependency 'bundler', '~> 1.16'
26+
spec.add_development_dependency 'rake', '~> 10.0'
27+
spec.add_development_dependency 'rspec', '~> 3.0'
28+
end

lib/convert_api.rb

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
require 'convert_api/version'
2+
require 'convert_api/configuration'
3+
4+
module ConvertApi
5+
module_function
6+
7+
def configure
8+
yield(config)
9+
end
10+
11+
def config
12+
@config ||= Configuration.new
13+
end
14+
end

lib/convert_api/configuration.rb

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
module ConvertApi
2+
class Configuration
3+
attr_accessor :api_secret
4+
attr_accessor :api_base_uri
5+
attr_accessor :request_timeout
6+
attr_accessor :upload_timeout
7+
attr_accessor :download_timeout
8+
9+
def initialize
10+
@api_base_uri = 'https://v2.convertapi.com'
11+
@request_timeout = 600
12+
@upload_timeout = 600
13+
@download_timeout = 600
14+
end
15+
end
16+
end

lib/convert_api/version.rb

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
module ConvertApi
2+
VERSION = '0.1.0'
3+
end

spec/convert_api_spec.rb

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
RSpec.describe ConvertApi do
2+
it 'has a version number' do
3+
expect(ConvertApi::VERSION).not_to be nil
4+
end
5+
6+
it 'has configuration defaults' do
7+
expect(ConvertApi.config.api_secret).to be_nil
8+
expect(ConvertApi.config.api_base_uri).not_to be_nil
9+
expect(ConvertApi.config.request_timeout).not_to be_nil
10+
expect(ConvertApi.config.upload_timeout).not_to be_nil
11+
expect(ConvertApi.config.download_timeout).not_to be_nil
12+
end
13+
14+
describe '.configure' do
15+
let(:api_secret) { 'test_secret' }
16+
let(:request_timeout) { 700 }
17+
18+
it 'configures' do
19+
ConvertApi.configure do |config|
20+
config.api_secret = api_secret
21+
config.request_timeout = request_timeout
22+
end
23+
24+
expect(ConvertApi.config.api_secret).to eq(api_secret)
25+
expect(ConvertApi.config.request_timeout).to eq(request_timeout)
26+
end
27+
end
28+
end

spec/spec_helper.rb

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
require 'bundler/setup'
2+
require 'convert_api'
3+
4+
RSpec.configure do |config|
5+
# Enable flags like --only-failures and --next-failure
6+
config.example_status_persistence_file_path = '.rspec_status'
7+
8+
# Disable RSpec exposing methods globally on `Module` and `main`
9+
config.disable_monkey_patching!
10+
11+
config.expect_with :rspec do |c|
12+
c.syntax = :expect
13+
end
14+
end

0 commit comments

Comments
 (0)