Skip to content

Commit e3753f2

Browse files
committed
Spec tags
1 parent abdd832 commit e3753f2

19 files changed

Lines changed: 75 additions & 28 deletions

README.md

Lines changed: 56 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ cloudconvert-ruby
33

44
> This is the official Ruby SDK for the [CloudConvert](https://cloudconvert.com/api/v2) API v2.
55
6-
## Installation
6+
7+
Installation
8+
------------
79

810
Add this line to your application's Gemfile:
911

@@ -23,19 +25,23 @@ Or install it yourself as:
2325
gem install cloudconvert
2426
```
2527

26-
## Creating API Client
28+
29+
Creating API Client
30+
-------------------
2731

2832
```rb
2933
cloudconvert = CloudConvert::Client.new(api_key: "API_KEY", sandbox: false)
3034
```
3135

32-
Or set the environment variable `CLOUDCONVERT_API_KEY` and use:
36+
Or set the environment variables `CLOUDCONVERT_API_KEY` and `CLOUDCONVERT_SANDBOX` and use:
3337

3438
```rb
3539
cloudconvert = CloudConvert::Client.new
3640
```
3741

38-
## Creating Jobs
42+
43+
Creating Jobs
44+
-------------
3945

4046
```rb
4147
cloudconvert.jobs.create({
@@ -61,7 +67,9 @@ cloudconvert.jobs.create({
6167
})
6268
```
6369

64-
## Downloading Files
70+
71+
Downloading Files
72+
-----------------
6573

6674
CloudConvert can generate public URLs for using `export/url` tasks.
6775

@@ -84,7 +92,9 @@ export = cloudconvert.download(file.url, destination: "/path/to/destination")
8492
The `download` method is powered by the [Down gem](https://github.com/janko/down),
8593
for the full list of arguments see the [the down docs](https://github.com/janko/down#down).
8694

87-
## Uploading Files
95+
96+
Uploading Files
97+
---------------
8898

8999
Uploads to CloudConvert are done via `import/upload` tasks (see the [docs](https://cloudconvert.com/api/v2/import#import-upload-tasks)):
90100

@@ -123,7 +133,9 @@ file = CloudConvert::File.new("/path/to/sample.pdf", "video/mp4", "sample.mp4")
123133
response = cloudconvert.tasks.upload(file, upload_task)
124134
```
125135

126-
## Webhooks
136+
137+
Webhooks
138+
--------
127139

128140
Webhooks can be created on the [CloudConvert Dashboard](https://cloudconvert.com/dashboard/api/v2/webhooks),
129141
where you can also find the signing secret.
@@ -190,21 +202,54 @@ The `verify`/`verify_request` methods return `true`/`false`, use `verify!` or `v
190202

191203
You can read the [full list of events](https://cloudconvert.com/api/v2/webhooks) CloudConvert can notify you about in our documentation.
192204

193-
## Development
205+
206+
Development
207+
-----------
194208

195209
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
196210

197211
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).
198212

199-
## Contributing
213+
214+
Contributing
215+
------------
200216

201217
Bug reports and pull requests are welcome on GitHub at https://github.com/cloudconvert/cloudconvert-ruby.
202218

203-
## License
219+
220+
Unit Tests
221+
----------
222+
223+
```sh
224+
rspec --tag unit
225+
```
226+
227+
228+
Integration Tests
229+
-----------------
230+
231+
```sh
232+
rspec --tag integration
233+
```
234+
235+
By default, this runs the integration tests against the Sandbox API with an official CloudConvert account.
236+
If you would like to use your own account, you can set your API key using the `CLOUDCONVERT_API_KEY` enviroment variable.
237+
In this case you need to whitelist the following MD5 hashes for Sandbox API (using the CloudConvert dashboard).
238+
239+
```
240+
53d6fe6b688c31c565907c81de625046 input.pdf
241+
99d4c165f77af02015aa647770286cf9 input.png
242+
```
243+
244+
245+
License
246+
-------
204247

205248
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
206249

207-
## Resources
250+
251+
Resources
252+
---------
208253

209254
* [API v2 Documentation](https://cloudconvert.com/api/v2)
210255
* [CloudConvert Blog](https://cloudconvert.com/blog)

lib/cloudconvert/client.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ def connection
9292
f.request :json
9393
f.request :multipart
9494
f.use CloudConvert::Middleware::ParseJson, content_type: /\bjson$/
95-
f.use FaradayMiddleware::ParseXml, content_type: /\bxml$/
95+
f.use CloudConvert::Middleware::ParseXml, content_type: /\bxml$/
9696
end
9797
end
9898

lib/cloudconvert/middleware.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,7 @@ class ParseJson < FaradayMiddleware::ParseJson
55
JSON.parse(body, object_class: OpenStruct) unless body.blank?
66
end
77
end
8+
9+
ParseXml = Class.new(FaradayMiddleware::ParseXml)
810
end
911
end

spec/client_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
describe CloudConvert::Client do
1+
describe CloudConvert::Client, unit: true do
22
API_KEY_ATTR = "api key from attrs"
33
API_KEY_ENV = "api key from env"
44

spec/cloudconvert_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
describe CloudConvert do
1+
describe CloudConvert, unit: true do
22
it "has api url" do
33
expect(CloudConvert::API_URL).to be_a String
44
end

spec/collection_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
describe CloudConvert::Collection do
1+
describe CloudConvert::Collection, unit: true do
22
let(:collection) do
33
CloudConvert::Collection.new [import_task, export_task]
44
end

spec/entity_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
describe CloudConvert::Entity do
1+
describe CloudConvert::Entity, unit: true do
22
describe ".result" do
33
it "should build an entity" do
44
entity = CloudConvert::Entity.result(OpenStruct.new(data: { id: 123 }))

spec/event_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
describe CloudConvert::Event do
1+
describe CloudConvert::Event, unit: true do
22
job = { id: SecureRandom.uuid }
33

44
describe "#==" do

spec/integration/jobs_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
require "integration_helper"
22

3-
describe CloudConvert::Resources::Jobs do
3+
describe CloudConvert::Resources::Jobs, integration: true do
44
let(:cloudconvert) do
55
CloudConvert::Client.new({
66
api_key: CLOUDCONVERT_SANDBOX_API_KEY,

spec/integration/tasks_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
require "integration_helper"
22

3-
describe CloudConvert::Resources::Tasks do
3+
describe CloudConvert::Resources::Tasks, integration: true do
44
let(:cloudconvert) do
55
CloudConvert::Client.new({
66
api_key: CLOUDCONVERT_SANDBOX_API_KEY,

0 commit comments

Comments
 (0)