fileturn 0.0.3 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (53) hide show
  1. checksums.yaml +6 -14
  2. data/.gitignore +1 -0
  3. data/README.md +49 -44
  4. data/fileturn.gemspec +1 -0
  5. data/lib/fileturn/errors.rb +14 -0
  6. data/lib/fileturn/http_client.rb +10 -8
  7. data/lib/fileturn/resources/account.rb +11 -35
  8. data/lib/fileturn/resources/conversion.rb +80 -0
  9. data/lib/fileturn/resources/resource.rb +0 -5
  10. data/lib/fileturn/version.rb +1 -1
  11. data/lib/fileturn.rb +6 -7
  12. data/spec/fileturn_spec.rb +5 -5
  13. data/spec/fixtures/vcr_cassettes/account_info.yml +24 -63
  14. data/spec/fixtures/vcr_cassettes/conversion_all_not_authorized.yml +48 -0
  15. data/spec/fixtures/vcr_cassettes/conversion_not_authorized.yml +48 -0
  16. data/spec/fixtures/vcr_cassettes/conversion_not_found.yml +48 -0
  17. data/spec/fixtures/vcr_cassettes/conversion_process_created.yml +52 -0
  18. data/spec/fixtures/vcr_cassettes/conversion_process_no_params.yml +97 -0
  19. data/spec/fixtures/vcr_cassettes/conversion_process_success.yml +50 -0
  20. data/spec/fixtures/vcr_cassettes/conversion_success.yml +50 -0
  21. data/spec/fixtures/vcr_cassettes/conversions_all.yml +50 -0
  22. data/spec/fixtures/vcr_cassettes/conversions_all_second.yml +97 -0
  23. data/spec/fixtures/vcr_cassettes/reload_.yml +52 -0
  24. data/spec/fixtures/vcr_cassettes/reload_done.yml +50 -0
  25. data/spec/resources/account_spec.rb +8 -23
  26. data/spec/resources/conversion_spec.rb +213 -0
  27. data/spec/resources/upload_spec.rb +35 -35
  28. data/spec/spec_helper.rb +1 -1
  29. data/spec/stub_http_client.rb +1 -1
  30. metadata +58 -61
  31. data/lib/fileturn/exceptions.rb +0 -30
  32. data/lib/fileturn/resources/file.rb +0 -112
  33. data/lib/fileturn/resources/notification.rb +0 -16
  34. data/spec/fixtures/vcr_cassettes/file_all.yml +0 -103
  35. data/spec/fixtures/vcr_cassettes/file_all_notifications.yml +0 -103
  36. data/spec/fixtures/vcr_cassettes/file_convert_no_params.yml +0 -87
  37. data/spec/fixtures/vcr_cassettes/file_convert_success.yml +0 -89
  38. data/spec/fixtures/vcr_cassettes/file_doesnt_upload_since_too_big.yml +0 -46
  39. data/spec/fixtures/vcr_cassettes/file_failed_.yml +0 -176
  40. data/spec/fixtures/vcr_cassettes/file_notifications.yml +0 -89
  41. data/spec/fixtures/vcr_cassettes/file_queued_.yml +0 -176
  42. data/spec/fixtures/vcr_cassettes/file_reload.yml +0 -132
  43. data/spec/fixtures/vcr_cassettes/file_success.yml +0 -89
  44. data/spec/fixtures/vcr_cassettes/file_success_.yml +0 -176
  45. data/spec/fixtures/vcr_cassettes/file_time_taken.yml +0 -176
  46. data/spec/fixtures/vcr_cassettes/file_unauthorized.yml +0 -87
  47. data/spec/fixtures/vcr_cassettes/file_upload_doc_queued.yml +0 -782
  48. data/spec/fixtures/vcr_cassettes/file_upload_not_enough_credits.yml +0 -130
  49. data/spec/fixtures/vcr_cassettes/file_upload_queued.yml +0 -203
  50. data/spec/fixtures/vcr_cassettes/upload_all.yml +0 -89
  51. data/spec/fixtures/vcr_cassettes/upload_one.yml +0 -89
  52. data/spec/fixtures/vcr_cassettes/upload_refetch.yml +0 -132
  53. data/spec/resources/file_spec.rb +0 -184
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- NmM2NzU5ZGFhMjI1MDA2Yjg0MjRkNjdiZDY4ODBkYThiZmEwZDU3Ng==
5
- data.tar.gz: !binary |-
6
- MDhiNWJjNmY2NDEyNGE4NzFiYjNiMTQyMmI4NGI3NGE4OGI1NjNiZQ==
7
- !binary "U0hBNTEy":
8
- metadata.gz: !binary |-
9
- N2NlNTViYzY3NDM0NzEzZTgxNjY5NzhlNTc0MDViNDc1YmI3MzgyM2VlMjBl
10
- ZWI2MzQ5MzY2MDMzY2EwYzdhMzY3NmFlMTY1Yzk1YTI4NmJiM2YxODBmYjZk
11
- N2RlZmVjOGU4OTNlYjY1YTY4MjQ1MTBkMzlkMzYwNTRjOTFiZDM=
12
- data.tar.gz: !binary |-
13
- Y2I4NTM4OTc1NDYwZmIwYTI4OTczNjQ5YzU1ZjhiNzJhYWYyODRkMTQ2NjRl
14
- MGQ0ZjAxNGUwMGVkMzUyNWIzZDhjOTMzMTljZTAyZDJmNDNiNTliZTBmMWIx
15
- ZGJmNDA4ZTRhZDZjYzg2NjgyYmVhZjY2MGJjNzFhMzljYzU1YTg=
2
+ SHA1:
3
+ metadata.gz: b1e266a662ba0d15012786458ba4c998e666c3bd
4
+ data.tar.gz: 0ef5ef52edf12544be1eab58c62503ff4ebea28c
5
+ SHA512:
6
+ metadata.gz: cf51f11c32f8b4b681ba3ab16a34be19fa7d29c1a389511862e92cd5652fbe35839b90f4211aba2aab29d1292c202df69bd06007c4a755af8662d2596120bbd4
7
+ data.tar.gz: f54833ad9c3a13e2ad375fa3191c1e817a662f6ceaa3cb4dfdfb42b0d37d40655035240e0c3fe5fa01b6d367c9790d8a810c182cf3b477ff3581e14375d9432c
data/.gitignore CHANGED
@@ -15,3 +15,4 @@ spec/reports
15
15
  test/tmp
16
16
  test/version_tmp
17
17
  tmp
18
+ .DS_Store
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Fileturn
2
2
 
3
- Ruby Gem Support for [FileTurn](http://fileturn.net/) Api. FileTurn converts your files to different formats.
3
+ Ruby Gem Support for [FileTurn](https://fileturn.net/) Api. FileTurn converts your files to different formats.
4
4
 
5
5
  ## Installation
6
6
 
@@ -18,9 +18,9 @@ Or install it yourself as:
18
18
 
19
19
  ## Configuration
20
20
 
21
- Retrieve your API Key from [Dashboard](http://fileturn.net/dashboard/api_token).
21
+ Retrieve your API Token from [Dashboard](https://fileturn.net/dashboard/api_token).
22
22
 
23
- FileTurn.configure(:api_key => "[YOUR KEY]")
23
+ FileTurn.configure(:api_token => "[YOUR KEY]")
24
24
 
25
25
  Thats it - now you are ready to use FileTurn.
26
26
 
@@ -30,78 +30,83 @@ Thats it - now you are ready to use FileTurn.
30
30
 
31
31
  There are multiple ways to convert a file. If your file is public, we can fetch the file and you just need to specify the url.
32
32
 
33
- file = FileTurn::File.convert(
33
+ conversion = FileTurn::Conversion.process!(
34
34
  :url => "http://crypto.stanford.edu/DRM2002/darknet5.doc",
35
- :convert_to => :pdf
35
+ :type => "WordToPdf"
36
36
  )
37
-
38
- unless file.errors
39
- # Woot done!
40
- end
41
37
 
42
38
  If your file is stored locally, you can use
43
39
 
44
- file = FileTurn::File.convert(
40
+ file = FileTurn::Conversion.process!(
45
41
  :file => File.open("localfile.doc"),
46
- :convert_to => :txt
42
+ :type => "WordToPdf"
47
43
  )
48
44
 
49
- Thats all you have to do to convert files. Upon calling that, your file will be queued for converting.
45
+ Thats all you have to do to convert files. Upon calling that, your file will be queued for converting. If there is an error queuing your file, an exception with base class of `FileTurn::FileTurnError` will be thrown.
46
+
47
+ Working with errors:
50
48
 
51
- ### How will i know when my file is done?
49
+ begin
50
+ file = FileTurn::Conversion.process!(
51
+ :file => File.open("localfile.doc"),
52
+ :type => "WordToPdf"
53
+ )
54
+ rescue FileTurn::FileTurnError => ex
55
+ # conversion queueing failed
56
+ end
57
+
58
+ ### How will i know when my conversion is done?
52
59
 
53
- #### File Object
60
+ #### Conversion Object
54
61
 
55
62
  There are few ways to check if your file is done. You can repeatedly call one of these:
56
63
 
57
- file.reload.queued?
58
- file.reload.success?
59
- file.reload.failed?
64
+ conversion.reload!.completed?
65
+ conversion.reload!.failed?
66
+ conversion.reload!.processing?
67
+ conversion.reload!.created?
60
68
 
61
- When your file is done, the file object will store a download link
69
+ When your conversion is done, the conversion object will have temporary download urls.
62
70
 
63
- while(file.reload.queued?)
64
- sleep(5000)
65
- end
66
-
67
- if file.success?
68
- download_url = file.download_url
69
- time_taken_for_conversion = file.time_taken
71
+ if conversion.completed?
72
+ download_url = conversion.temporary_download_urls
73
+ time_taken_for_conversion = conversion.processing_time_in_seconds
70
74
  end
71
75
 
72
76
  In the case you get a failure, you can retrieve the details using
73
77
 
74
- if(file.reload.failed?)
75
- file.notifications.last.details
76
- end
78
+ conversion.error_type
79
+ conversion.error_details
77
80
 
78
81
  #### Notifications
79
82
 
80
- You can also request notification to be sent to you whenver the status of a file changes. Go into your [Dashboard](http://fileturn.net/dashboard/notifications) and specify a notification url.
81
-
82
- We will hit this notification url with the new status of the file and the file_id.
83
+ You can also request notification to be sent to you whenever the status of a conversion changes via webhooks. Go into your [Dashboard](https://fileturn.net/dashboard/notifications) and specify a webhook url.
83
84
 
85
+ ## Fetching Conversion(s)
84
86
 
85
- ## Other File Options
87
+ You can fetch information of a single conversion using an id.
86
88
 
87
- You can fetch information of a single file using the file_id.
89
+ FileTurn::Conversion.find(id)
88
90
 
89
- FileTurn::File.find(file_id)
90
-
91
- Or all the files
91
+ Or all the conversions
92
92
 
93
- FileTurn::File.all
94
-
93
+ FileTurn::Conversion.all
95
94
 
96
95
  ## Account Details
97
96
 
98
- You can also fetch account details like how much credit you have.
97
+ You can fetch account details
99
98
 
100
- FileTurn::Account.load # fetch data from server
101
- FileTurn::Account.credits
99
+ account = FileTurn::Account.load # fetch data from server
102
100
 
103
- Or you can use
101
+ # plan details
102
+ account.plan.name
103
+ account.plan.max_file_size_in_mb
104
+ account.plan.conversions_per_month
105
+ account.plan.max_requests_per_second
104
106
 
105
- FileTurn::Account.load.credits
107
+ # stats for account (for current billing cycle)
108
+ account.subscription.stats.conversions_left
109
+ account.subscription.stats.successful_conversions
110
+ account.subscription.stats.failed_conversions
111
+ account.subscription.stats.processing_conversions
106
112
 
107
- Thanks!
data/fileturn.gemspec CHANGED
@@ -18,6 +18,7 @@ Gem::Specification.new do |spec|
18
18
  spec.require_paths = ["lib"]
19
19
 
20
20
  spec.add_dependency "faraday"
21
+ spec.add_dependency "recursive-open-struct"
21
22
 
22
23
  spec.add_development_dependency "bundler", "~> 1.3"
23
24
  spec.add_development_dependency "rake"
@@ -0,0 +1,14 @@
1
+ module FileTurn
2
+ class FileTurnError < Exception; end
3
+ class NotFoundError < FileTurnError; end;
4
+ class UnauthorizedError < FileTurnError; end;
5
+ class UnknownError < FileTurnError; end;
6
+
7
+ class BadRequestError < FileTurnError
8
+ attr_reader :errors
9
+
10
+ def initialize(resp)
11
+ @errors = resp['errors']
12
+ end
13
+ end
14
+ end
@@ -6,7 +6,7 @@ module FileTurn
6
6
  class HttpClient
7
7
 
8
8
  def self.conn
9
- @conn ||= Faraday.new(:url => 'http://fileturn.net/')
9
+ @conn ||= Faraday.new(:url => 'https://fileturn.net/')
10
10
  end
11
11
 
12
12
  def self.get(url, params, status_codes, &block)
@@ -29,20 +29,22 @@ module FileTurn
29
29
  end
30
30
 
31
31
  def self.setup_params(params)
32
- params['token'] = FileTurn.api_key
32
+ params['api_token'] = FileTurn.api_token
33
33
  params
34
34
  end
35
35
 
36
36
  def self.handle_error(resp)
37
37
  case resp.status
38
+ when 200..399
39
+ nil
40
+ when 400
41
+ raise FileTurn::BadRequestError.new(JSON.parse(resp.body))
38
42
  when 401
39
- raise FileTurn::UnauthorizedException.new(resp)
40
- when 500
41
- raise FileTurn::InternalServerException.new(resp)
42
- when 422
43
- OpenStruct.new(JSON.parse(resp.body))
43
+ raise FileTurn::UnauthorizedError.new(resp)
44
+ when 404
45
+ raise FileTurn::NotFoundError.new(resp)
44
46
  else
45
- nil
47
+ raise FileTurn::UnknownError.new(resp)
46
48
  end
47
49
  end
48
50
  end
@@ -1,46 +1,22 @@
1
1
  module FileTurn
2
2
  class Account < Resource
3
+
4
+ def initialize(params)
5
+ @params = RecursiveOpenStruct.new(params, recurse_over_arrays: true)
6
+ end
7
+
8
+ def method_missing(m, *args, &block)
9
+ @params.send(m)
10
+ self
11
+ end
3
12
 
4
13
  class << self
5
- @account = OpenStruct.new()
6
-
7
14
  def load
8
15
  conn.get("/users.json", {}, 200) do |params|
9
- params['created_at'] = DateTime.parse(params['created_at'])
10
- @account = OpenStruct.new(params)
11
- self
16
+ FileTurn::Account.new(params)
12
17
  end
13
18
  end
14
-
15
- def load_only_if_not_loaded
16
- load if @account.nil? || @account.id.nil?
17
- self
18
- end
19
-
20
- def id
21
- @account.id
22
- end
23
-
24
- def credits
25
- @account.credits
26
- end
27
-
28
- def created_at
29
- @account.created_at
30
- end
31
-
32
- def notification_url
33
- @account.notification_url
34
- end
35
-
36
- def time_zone
37
- @account.time_zone
38
- end
39
-
40
- def max_file_size_in_bytes
41
- @account.max_file_size_in_bytes
42
- end
43
19
  end
44
20
 
45
21
  end
46
- end
22
+ end
@@ -0,0 +1,80 @@
1
+ module FileTurn
2
+ class Conversion < Resource
3
+ attr_reader :params
4
+
5
+ def initialize(params)
6
+ @params = RecursiveOpenStruct.new(params, recurse_over_arrays: true)
7
+ end
8
+
9
+ def method_missing(m, *args, &block)
10
+ @params.send(m)
11
+ end
12
+
13
+ def reload!
14
+ @params = FileTurn::Conversion.find(id).params
15
+ self
16
+ end
17
+
18
+ ['created', 'processing', 'failed', 'completed'].each do |s|
19
+ define_method("#{s}?") do
20
+ s == status
21
+ end
22
+ end
23
+
24
+ # class
25
+ class << self
26
+
27
+ def find(id, &block)
28
+ conn.get("/conversions/#{id}.json", {}, 200) do |params|
29
+ FileTurn::Conversion.new(params)
30
+ end
31
+ end
32
+
33
+ def all(per: 20, page: 1)
34
+ conn.get("conversions.json", { per: per, page: page }, 200) do |params|
35
+ params['conversions'].map! { |conv| FileTurn::Conversion.new(conv) }
36
+ RecursiveOpenStruct.new(params, recurse_over_arrays: true)
37
+ end
38
+ end
39
+
40
+ def process!(params)
41
+ conn.post("conversions.json", params, 200) do |params|
42
+ FileTurn::Conversion.new(params)
43
+ end
44
+ end
45
+
46
+ private
47
+
48
+ # def upload_file(file, params)
49
+ # evaluate_file_size = FileTurn::Upload.send(:evaluate_file_size, file)
50
+ # return evaluate_file_size unless evaluate_file_size.nil?
51
+
52
+ # signed_params = FileTurn::Upload.send(:signed_upload_url, file)
53
+ # return signed_params if signed_params.errors
54
+
55
+ # faraday = Faraday.new(:url => signed_params.url) do |conn|
56
+ # conn.request :multipart
57
+ # conn.adapter :net_http
58
+ # end
59
+
60
+ # response = faraday.post '/', {
61
+ # :policy => signed_params.policy,
62
+ # :signature => signed_params.signature,
63
+ # 'AWSAccessKeyId' => signed_params.aws_access_key_id,
64
+ # :key => signed_params.key,
65
+ # :file => Faraday::UploadIO.new(file.path, '')
66
+ # }
67
+
68
+ # if response.status == 204
69
+ # params[:file] = params['file'] = nil
70
+ # params['url'] = "#{signed_params.url}/#{signed_params.key}"
71
+ # params['file_type'] = signed_params.file_type
72
+ # params['upload_id'] = signed_params.id
73
+ # convert(params)
74
+ # end
75
+ # end
76
+
77
+ end
78
+
79
+ end
80
+ end
@@ -8,10 +8,5 @@ module FileTurn
8
8
  end
9
9
  end
10
10
 
11
- # instance
12
- def errors
13
- false
14
- end
15
-
16
11
  end
17
12
  end
@@ -1,3 +1,3 @@
1
1
  module Fileturn
2
- VERSION = "0.0.3"
2
+ VERSION = "0.1.0"
3
3
  end
data/lib/fileturn.rb CHANGED
@@ -1,19 +1,18 @@
1
1
  module FileTurn
2
2
  extend self
3
3
 
4
- attr_reader :api_key
4
+ attr_reader :api_token
5
5
 
6
6
  def configure(params={})
7
- raise ArgumentError, "missing params (api_key)" if params[:api_key].nil?
8
- @api_key = params[:api_key]
7
+ raise ArgumentError, "missing params (api_token)" if params[:api_token].nil?
8
+ @api_token = params[:api_token]
9
9
  end
10
10
  end
11
11
 
12
- require 'date'
13
- require "fileturn/exceptions"
12
+ require 'recursive-open-struct'
13
+ require "fileturn/errors"
14
14
  require "fileturn/http_client"
15
15
  require "fileturn/resources/resource"
16
16
  require "fileturn/resources/account"
17
17
  require "fileturn/resources/upload"
18
- require "fileturn/resources/notification"
19
- require "fileturn/resources/file"
18
+ require "fileturn/resources/conversion"
@@ -3,13 +3,13 @@ require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
3
3
  describe FileTurn do
4
4
 
5
5
  describe '#configure' do
6
- it 'sets up api key' do
7
- FileTurn.configure(:api_key => "123")
8
- FileTurn.api_key.should == "123"
6
+ it 'sets up api token' do
7
+ FileTurn.configure(api_token: "123")
8
+ expect(FileTurn.api_token).to eq("123")
9
9
  end
10
10
 
11
- it 'raises exception if not api key is passed' do
12
- expect { FileTurn.configure({}) }.to raise_error
11
+ it 'raises exception if not api token is passed' do
12
+ expect { FileTurn.configure({}) }.to raise_error(ArgumentError)
13
13
  end
14
14
  end
15
15
 
@@ -2,89 +2,50 @@
2
2
  http_interactions:
3
3
  - request:
4
4
  method: get
5
- uri: http://localhost:3000/api/users.json?token=67sFfjudMpXxJeioQcPSppYkoVdQD1oetqPWzMAh
5
+ uri: http://localhost:5000/api/users.json?api_token=51d5fc191b2b95f9278becf6b51fa347
6
6
  body:
7
7
  encoding: US-ASCII
8
8
  string: ''
9
9
  headers:
10
10
  User-Agent:
11
- - Faraday v0.8.7
11
+ - Faraday v0.15.2
12
12
  Accept-Encoding:
13
13
  - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14
14
  Accept:
15
- - ! '*/*'
15
+ - "*/*"
16
16
  response:
17
17
  status:
18
18
  code: 200
19
- message: ! 'OK '
19
+ message: OK
20
20
  headers:
21
+ X-Frame-Options:
22
+ - SAMEORIGIN
23
+ X-Xss-Protection:
24
+ - 1; mode=block
25
+ X-Content-Type-Options:
26
+ - nosniff
27
+ X-Download-Options:
28
+ - noopen
29
+ X-Permitted-Cross-Domain-Policies:
30
+ - none
31
+ Referrer-Policy:
32
+ - strict-origin-when-cross-origin
21
33
  Content-Type:
22
34
  - application/json; charset=utf-8
23
- X-Ua-Compatible:
24
- - IE=Edge
25
35
  Etag:
26
- - ! '"108135fed6135342e058ab4865b5301f"'
36
+ - W/"0d66b13e67af61ea36799ae5e7c780f1"
27
37
  Cache-Control:
28
38
  - max-age=0, private, must-revalidate
29
39
  X-Request-Id:
30
- - 3f36878be082fdb201b2015c688aa367
40
+ - 8d6cd7e4-5ab9-414e-a35b-bc52a27ad8f2
31
41
  X-Runtime:
32
- - '0.112629'
33
- Server:
34
- - WEBrick/1.3.1 (Ruby/1.9.3/2012-11-10)
35
- Date:
36
- - Sun, 07 Jul 2013 22:46:58 GMT
37
- Content-Length:
38
- - '177'
39
- Connection:
40
- - Keep-Alive
41
- body:
42
- encoding: US-ASCII
43
- string: ! '{"id":8,"created_at":"2013-07-05T22:14:10Z","credits":27836,"notification_url":"http://localhost:3000","time_zone":"Eastern
44
- Time (US & Canada)","max_file_size_in_bytes":1048576}'
45
- http_version:
46
- recorded_at: Sun, 07 Jul 2013 22:46:58 GMT
47
- - request:
48
- method: get
49
- uri: http://fileturn.net/api/users.json?token=67sFfjudMpXxJeioQcPSppYkoVdQD1oetqPWzMAh
50
- body:
51
- encoding: US-ASCII
52
- string: ''
53
- headers:
54
- User-Agent:
55
- - Faraday v0.8.7
56
- Accept-Encoding:
57
- - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
58
- Accept:
59
- - ! '*/*'
60
- response:
61
- status:
62
- code: 401
63
- message: Unauthorized
64
- headers:
65
- Cache-Control:
66
- - no-cache
67
- Content-Type:
68
- - application/json; charset=utf-8
69
- Date:
70
- - Wed, 10 Jul 2013 02:23:45 GMT
71
- Status:
72
- - 401 Unauthorized
73
- X-Rack-Cache:
74
- - miss
75
- X-Request-Id:
76
- - ba809a4faf572e1c93137e8dec3e5ed4
77
- X-Runtime:
78
- - '0.011111'
79
- X-Ua-Compatible:
80
- - IE=Edge,chrome=1
42
+ - '0.031059'
81
43
  Transfer-Encoding:
82
44
  - chunked
83
- Connection:
84
- - keep-alive
85
45
  body:
86
- encoding: US-ASCII
87
- string: ! '{"error":"Your token is invalid","status":401}'
46
+ encoding: UTF-8
47
+ string: '{"id":"3d96a094-dde5-4319-b5fb-bb87aabc7b0e","email":"test@test.com","plan":{"name":"free","max_file_size_in_mb":3,"conversions_per_month":50,"max_requests_per_second":1},"time_zone":"Eastern
48
+ Time (US \u0026 Canada)","subscription":{"billing_cycle_started":"2018-07-09T21:21:55.000+00:00","billing_cycle_ends":"2018-08-09T21:21:55.000+00:00","stats":{"conversions_left":0,"successful_conversions":50,"failed_conversions":0,"processing_conversions":0}}}'
88
49
  http_version:
89
- recorded_at: Wed, 10 Jul 2013 02:26:15 GMT
90
- recorded_with: VCR 2.4.0
50
+ recorded_at: Tue, 10 Jul 2018 00:48:08 GMT
51
+ recorded_with: VCR 4.0.0
@@ -0,0 +1,48 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://localhost:5000/api/conversions.json?api_token=123&page=1&per=20
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.15.2
12
+ Accept-Encoding:
13
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14
+ Accept:
15
+ - "*/*"
16
+ response:
17
+ status:
18
+ code: 401
19
+ message: Unauthorized
20
+ headers:
21
+ X-Frame-Options:
22
+ - SAMEORIGIN
23
+ X-Xss-Protection:
24
+ - 1; mode=block
25
+ X-Content-Type-Options:
26
+ - nosniff
27
+ X-Download-Options:
28
+ - noopen
29
+ X-Permitted-Cross-Domain-Policies:
30
+ - none
31
+ Referrer-Policy:
32
+ - strict-origin-when-cross-origin
33
+ Content-Type:
34
+ - application/json; charset=utf-8
35
+ Cache-Control:
36
+ - no-cache
37
+ X-Request-Id:
38
+ - 6f8608e9-c3ee-4991-9d1f-69b6c377cb6d
39
+ X-Runtime:
40
+ - '0.005255'
41
+ Transfer-Encoding:
42
+ - chunked
43
+ body:
44
+ encoding: UTF-8
45
+ string: '{"errors":["unauthorized"]}'
46
+ http_version:
47
+ recorded_at: Tue, 10 Jul 2018 01:34:00 GMT
48
+ recorded_with: VCR 4.0.0
@@ -0,0 +1,48 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://localhost:5000/api/conversions/b120b954-82b2-41c6-bef2-c83b3462463b.json?api_token=123
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Faraday v0.15.2
12
+ Accept-Encoding:
13
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14
+ Accept:
15
+ - "*/*"
16
+ response:
17
+ status:
18
+ code: 404
19
+ message: Not Found
20
+ headers:
21
+ X-Frame-Options:
22
+ - SAMEORIGIN
23
+ X-Xss-Protection:
24
+ - 1; mode=block
25
+ X-Content-Type-Options:
26
+ - nosniff
27
+ X-Download-Options:
28
+ - noopen
29
+ X-Permitted-Cross-Domain-Policies:
30
+ - none
31
+ Referrer-Policy:
32
+ - strict-origin-when-cross-origin
33
+ Content-Type:
34
+ - application/json; charset=utf-8
35
+ Cache-Control:
36
+ - no-cache
37
+ X-Request-Id:
38
+ - 612be496-1127-4844-9093-597a64c1e505
39
+ X-Runtime:
40
+ - '0.012557'
41
+ Transfer-Encoding:
42
+ - chunked
43
+ body:
44
+ encoding: UTF-8
45
+ string: '{"errors":["not found"]}'
46
+ http_version:
47
+ recorded_at: Tue, 10 Jul 2018 01:22:35 GMT
48
+ recorded_with: VCR 4.0.0