rev-api 2.0.0 → 2.0.1

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: 9135f3db4724a4e4f1744d05f37c11f8af8a69ac
4
- data.tar.gz: 5cc28e64e847cef9dde1bfe3d2a0b5ccb3371332
3
+ metadata.gz: d4744540dd0b2d79158797926179f47d92ec0941
4
+ data.tar.gz: f5fb0b58a5a99cbe9b102a822e4e5cc46d82150e
5
5
  SHA512:
6
- metadata.gz: 3a620695e2f0f80045ed11ffbdbeeb04e0f115b2e1babfb4db97235eefc22f4d51801663e1a01a487c9e56eef8e4f556b7f921b059ff5756d99571061790b04e
7
- data.tar.gz: 033c6a42317c8e1c2282aab691eea932651f49a1b424050205ecd98c03a8352c4b00fe12bb6c54bccf77c5a065c8354946fe2e2dfdca90e2511c18f153ac3c08
6
+ metadata.gz: 4f084b93b5f0255b1080010ee73c2412af0d5368eea5bbc2cb5676e5aa768d89a97023b8f54c82f4fa96a025c1a531a6202b3a4f4078cd628b849673b999255d
7
+ data.tar.gz: 69b1dfb44c0b64003328a1ecf7336a2dad3fa1e95c29af332fc5efdad331cd68fd12889949e0d61b28854b1a2f2bfbb2e24328eaefd352d58b8f8cb86cbbf98a
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- rev-api (2.0.0)
4
+ rev-api (2.0.1)
5
5
  httparty (~> 0.11, >= 0.11.0)
6
6
 
7
7
  GEM
@@ -17,14 +17,13 @@ GEM
17
17
  thor
18
18
  crack (0.4.1)
19
19
  safe_yaml (~> 0.9.0)
20
- httparty (0.13.1)
21
- json (~> 1.8)
20
+ httparty (0.11.0)
21
+ multi_json (~> 1.0)
22
22
  multi_xml (>= 0.5.2)
23
- json (1.8.1)
24
23
  mime-types (1.25)
25
24
  multi_json (1.8.0)
26
25
  multi_xml (0.5.5)
27
- rake (10.1.0)
26
+ rake (10.4.2)
28
27
  redcarpet (3.0.0)
29
28
  rest-client (1.6.7)
30
29
  mime-types (>= 1.16)
data/README.md CHANGED
@@ -4,7 +4,7 @@
4
4
  [![Code Climate](https://codeclimate.com/github/revdotcom/rev-ruby-sdk.png)](https://codeclimate.com/github/revdotcom/rev-ruby-sdk)
5
5
  [![Coverage Status](https://coveralls.io/repos/revdotcom/rev-ruby-sdk/badge.png)](https://coveralls.io/r/revdotcom/rev-ruby-sdk)
6
6
 
7
- [Reference](http://www.rev.com/api/docs) | [RDocs](http://rubydoc.info/github/revdotcom/rev-ruby-sdk/master/frames)
7
+ [Reference](https://www.rev.com/api/docs) | [RDocs](http://rubydoc.info/github/revdotcom/rev-ruby-sdk/master/frames)
8
8
 
9
9
  rev-ruby-sdk
10
10
  ------------
@@ -12,10 +12,10 @@ rev-ruby-sdk
12
12
  ### Background
13
13
 
14
14
  Rev.com provides transcription and translation services powered by humans. The Rev.com API allows you to tap these services
15
- with no manual steps. It's a RESTful API, documented at <http://www.rev.com/api/docs>.
15
+ with no manual steps. It's a RESTful API, documented at <https://www.rev.com/api/docs>.
16
16
 
17
17
  The Ruby SDK for the Rev API provides a convenient Ruby wrapper for the Rev.com API. All operations of the API, as described
18
- at <http://www.rev.com/api/operations>, are supported.
18
+ at <https://www.rev.com/api/operations>, are supported.
19
19
 
20
20
  ### Install
21
21
 
@@ -33,7 +33,7 @@ require 'rev-api'
33
33
 
34
34
  ### Authentication
35
35
 
36
- If you are building a new API client, you must first obtain a client API key, which you can do at <http://www.rev.com/api>.
36
+ If you are building a new API client, you must first obtain a client API key, which you can do at <https://www.rev.com/api>.
37
37
 
38
38
  All operations in the API are performed on behalf of a Rev customer, identified by their user API key. The client key / user
39
39
  key pair is used to authenticate each API operation. Once you have the two keys, you can create a new Rev.com API client:
@@ -45,7 +45,7 @@ require 'rev-api'
45
45
  rev_client = Rev.new('your_client_key', 'your_user_key')
46
46
  ```
47
47
 
48
- You can read more about authentication in the Rev.com API at <http://www.rev.com/api/security>
48
+ You can read more about authentication in the Rev.com API at <https://www.rev.com/api/security>
49
49
 
50
50
  ### Sandbox
51
51
 
@@ -74,6 +74,7 @@ rev_client = Rev.new('your_client_key', 'your_user_key')
74
74
  ```ruby
75
75
  orders_page = rev_client.get_orders_page(1); # get a single page of orders
76
76
  all_orders = rev_client.get_all_orders; # get first page of orders history
77
+ orders_by_client_ref = rev_client.get_orders_by_client_ref('some_ref'); # get orders with reference id of 'some_ref'
77
78
  ```
78
79
 
79
80
  #### Get a single order by order number
@@ -106,7 +107,7 @@ Refer to `cli.rb` in the `examples` directory for a full example illustrating pl
106
107
 
107
108
  [YARD documentation](http://rubydoc.info/github/revdotcom/rev-ruby-sdk/master/frames) can be generated locally by running `rake yard` command, and will be placed in the `doc` directory.
108
109
 
109
- You can find API documentation at <http://www.rev.com/api/docs>.
110
+ You can find API documentation at <https://www.rev.com/api/docs>.
110
111
 
111
112
  ### Support
112
113
 
@@ -11,7 +11,7 @@ require 'pp'
11
11
  # ruby examples/cli.rb --sandbox --client-key your_client_key --user-key your_user_key
12
12
 
13
13
  class RevCLI
14
- COMMANDS = %w{help get list transcripts captions dl_transcripts dl_captions dl_sources place_tc place_cp cancel}
14
+ COMMANDS = %w{help get get_by_client_ref list transcripts captions dl_transcripts dl_captions dl_sources place_tc place_cp cancel}
15
15
 
16
16
  def initialize
17
17
  options = { :environment => Rev::Api::PRODUCTION_HOST, :verbatim => false, :timestamps => false }
@@ -94,6 +94,24 @@ class RevCLI
94
94
  puts 'There are no orders placed so far.' if orders.empty?
95
95
  end
96
96
 
97
+ def get_by_client_ref(args)
98
+ # client ref can contain spaces, so we have to join client ref from pieces
99
+ if (args.last == '0' || args.last.to_i > 0)
100
+ client_ref = args[0..-2].join(' ')
101
+ else
102
+ client_ref = args.join(' ')
103
+ end
104
+
105
+ client_ref = client_ref.gsub('\'', '').gsub('"', '')
106
+ page = args.last.nil? ? 0: args.last.to_i
107
+
108
+ orders_first_page = @rev_client.get_orders_by_client_ref(client_ref, page)
109
+ puts "Found #{orders_first_page.total_count} order(s), showing page #{page}. Pass page number as second argument"
110
+ orders_first_page.orders.each { |o| puts ("#{o.client_ref}: #{o.order_number}") }
111
+
112
+ puts "There are no orders associated with the given client reference: #{client_ref}" if orders_first_page.orders.empty?
113
+ end
114
+
97
115
  def transcripts(args)
98
116
  begin
99
117
  order_num = args[0]
@@ -221,11 +239,11 @@ class RevCLI
221
239
  end
222
240
 
223
241
  def help(*args)
224
- puts "commands are: #{COMMANDS.join(' ')} help exit"
242
+ puts "commands are: #{COMMANDS.join(' ')} exit"
225
243
  end
226
-
244
+
227
245
  private
228
-
246
+
229
247
  def upload(args, type)
230
248
  input_urls = args.map do |f|
231
249
  puts "Uploading #{f}"
@@ -233,7 +251,7 @@ class RevCLI
233
251
  end
234
252
  input_urls
235
253
  end
236
-
254
+
237
255
  def place_helper(inputs, options)
238
256
  options = options.merge({ :client_ref => 'XB432423', :comment => 'Please work quickly' })
239
257
  request = Rev::OrderRequest.new(options)
@@ -245,7 +263,7 @@ class RevCLI
245
263
  puts "Order placement failed with error code #{e.code}, message #{e.message}"
246
264
  end
247
265
  end
248
-
266
+
249
267
  end
250
268
 
251
269
  cli = RevCLI.new
@@ -22,7 +22,7 @@ module Rev
22
22
  # into Rev::Api ctor
23
23
  SANDBOX_HOST = 'api-sandbox.rev.com'
24
24
 
25
- # @note http://www.rev.com/api/security
25
+ # @note https://www.rev.com/api/security
26
26
  # @param client_api_key [String] secret key specific to each partner that wishes to use the Rev API
27
27
  # @param user_api_key [String] secret key specific to a Rev user, which identifies the user account under whose privileges the requested operation executes
28
28
  # @param host [String] use {Rev::Api::PRODUCTION_HOST} or {Rev::Api::SANDBOX_HOST}. Production is default value
@@ -33,9 +33,9 @@ module Rev
33
33
 
34
34
  # Loads single page of existing orders for current client
35
35
  #
36
- # @note http://www.rev.com/api/ordersget
36
+ # @note https://www.rev.com/api/ordersget
37
37
  # @param page [Int, nil] 0-based page number, defaults to 0
38
- # @return [OrdersListPage] paged result cointaining 'orders'
38
+ # @return [OrdersListPage] paged result containing 'orders'
39
39
  def get_orders_page(page = 0)
40
40
  response = @client.get("/orders?page=#{page.to_i}")
41
41
  Api.verify_get_response(response)
@@ -45,7 +45,7 @@ module Rev
45
45
  # Loads all orders for current client. Works by calling get_orders_page multiple times.
46
46
  # Use with caution if your order list might be large.
47
47
  #
48
- # @note http://www.rev.com/api/ordersget
48
+ # @note https://www.rev.com/api/ordersget
49
49
  # @return [Array of Order] list of orders
50
50
  def get_all_orders
51
51
  orders = []
@@ -59,9 +59,24 @@ module Rev
59
59
  orders
60
60
  end
61
61
 
62
+ # Loads orders whose associated reference ID is the given client_ref
63
+ #
64
+ # @note https://www.rev.com/api/ordersget
65
+ # @param client_ref [String, nil] client reference (required)
66
+ # @param page [Int, nil] 0-based page number, defaults to 0
67
+ # @return [OrdersListPage] paged result containing 'orders' list
68
+ # @raise [ArgumentError] client_ref is nil
69
+ def get_orders_by_client_ref(client_ref, page = 0)
70
+ raise ArgumentError if client_ref.nil?
71
+
72
+ response = @client.get("/orders?clientRef=#{URI.escape(client_ref)}&page=#{page.to_i}")
73
+ Api.verify_get_response(response)
74
+ OrdersListPage.new(Api.parse(response))
75
+ end
76
+
62
77
  # Returns Order given an order number.
63
78
  #
64
- # @note http://www.rev.com/api/ordersgetone
79
+ # @note https://www.rev.com/api/ordersgetone
65
80
  # @param number [String] order number, like 'TCXXXXXXXX'
66
81
  # @return [Order] order obj
67
82
  def get_order(number)
@@ -72,7 +87,7 @@ module Rev
72
87
 
73
88
  # Cancel an order by number. If cancellation is not allowed, Rev::Api::BadRequestError is raised.
74
89
  #
75
- # @note http://www.rev.com/api/orderscancel
90
+ # @note https://www.rev.com/api/orderscancel
76
91
  # @param number [String] order number
77
92
  # @return [Boolean] true on success, raised Exception from Rev::Api namespace otherwise
78
93
  def cancel_order(number)
@@ -85,7 +100,7 @@ module Rev
85
100
  # Use this method to retrieve information about an order attachment (either transcript,
86
101
  # translation, or source file).
87
102
  #
88
- # @note http://www.rev.com/api/attachmentsget
103
+ # @note https://www.rev.com/api/attachmentsget
89
104
  # @param id [String] attachment id, as returned in info about an order
90
105
  # @return [Attachment] attachment object
91
106
  def get_attachment_metadata(id)
@@ -101,7 +116,7 @@ module Rev
101
116
  # representation, specified via a mime-type.
102
117
  #
103
118
  # See {Rev::Order::Attachment::REPRESENTATIONS} hash, which contains symbols for currently supported mime types.
104
- # The authoritative list is in the API documentation at http://www.rev.com/api/attachmentsgetcontent
119
+ # The authoritative list is in the API documentation at https://www.rev.com/api/attachmentsgetcontent
105
120
  #
106
121
  # If a block is given, the response is passed to the block directly, to allow progressive reading of the data.
107
122
  # In this case, the block must itself check for error responses, using Api.verify_get_response.
@@ -136,7 +151,7 @@ module Rev
136
151
  # representation, specified via a mime-type.
137
152
  #
138
153
  # See {Rev::Order::Attachment::REPRESENTATIONS} hash, which contains symbols for currently supported mime types.
139
- # The authoritative list is in the API documentation at http://www.rev.com/api/attachmentsgetcontent
154
+ # The authoritative list is in the API documentation at https://www.rev.com/api/attachmentsgetcontent
140
155
  #
141
156
  # @param id [String] attachment id
142
157
  # @param path [String, nil] path to file into which the content is to be saved.
@@ -178,7 +193,7 @@ module Rev
178
193
  end
179
194
 
180
195
  # Submit a new order using {Rev::OrderRequest}.
181
- # @note http://www.rev.com/api/ordersposttranscription - for full information
196
+ # @note https://www.rev.com/api/ordersposttranscription - for full information
182
197
  #
183
198
  # @param order_request [OrderRequest] object specifying payment, inputs, options and notification info.
184
199
  # inputs must previously be uploaded using upload_input or create_input_from_link
@@ -194,7 +209,7 @@ module Rev
194
209
  end
195
210
 
196
211
  # Upload given local file directly as source input for order.
197
- # @note http://www.rev.com/api/inputspost
212
+ # @note https://www.rev.com/api/inputspost
198
213
  #
199
214
  # @param path [String] mandatory, path to local file (relative or absolute) to upload
200
215
  # @param content_type [String] mandatory, content-type of the file you're uploading
@@ -219,7 +234,7 @@ module Rev
219
234
  end
220
235
 
221
236
  # Request creation of a source input based on an external URL which the server will attempt to download.
222
- # @note http://www.rev.com/api/inputspost
237
+ # @note https://www.rev.com/api/inputspost
223
238
  #
224
239
  # @param url [String] mandatory, URL where the media can be retrieved. Must be publicly accessible.
225
240
  # HTTPS urls are ok as long as the site in question has a valid certificate
@@ -271,7 +286,7 @@ module Rev
271
286
 
272
287
  # (see #verify_get_response)
273
288
  def verify_post_response(response)
274
- # see http://www.rev.com/api/errorhandling
289
+ # see https://www.rev.com/api/errorhandling
275
290
  unless response.response.instance_of?(Net::HTTPCreated) || response.response.instance_of?(Net::HTTPNoContent)
276
291
  Api.handle_error(response)
277
292
  end
@@ -84,7 +84,7 @@ module Rev
84
84
 
85
85
  module InputRequestErrorCodes
86
86
  # 10001 Unsupported Content Type – if the content type of the media is not currently supported by our system.
87
- # Supported media types for inputs are listed in http://www.rev.com/api/inputspost
87
+ # Supported media types for inputs are listed in https://www.rev.com/api/inputspost
88
88
  UNSUPPORTED_CONTENT_TYPE = 10001
89
89
 
90
90
  # 10002 Could not retrieve file – if we could not retrieve the file from the specified location.
@@ -5,7 +5,7 @@ module Rev
5
5
  # It consists of three main elements: :payment, :transcription_options and :notification.
6
6
  # You can also supply priority, reference number, and customer comment
7
7
  #
8
- # @note http://www.rev.com/api/ordersposttranscription, http://www.rev.com/api/ordersposttranslation, http://www.rev.com/api/orderspostcaption
8
+ # @note https://www.rev.com/api/ordersposttranscription, https://www.rev.com/api/ordersposttranslation, https://www.rev.com/api/orderspostcaption
9
9
  class OrderRequest < ApiSerializable
10
10
  # see {Rev::Payment}
11
11
  attr_reader :payment
@@ -15,7 +15,7 @@ module Rev
15
15
 
16
16
  # see {Rev::TranslationOptions}
17
17
  attr_reader :translation_options
18
-
18
+
19
19
  # see {Rev::CaptionOptions}
20
20
  attr_reader :caption_options
21
21
 
@@ -27,10 +27,10 @@ module Rev
27
27
 
28
28
  # a comment with any special messages about the order (optional)
29
29
  attr_reader :comment
30
-
30
+
31
31
  # a requested priority for the order, defaults to normal (optional)
32
32
  attr_reader :priority
33
-
33
+
34
34
  # use to correctly set priority
35
35
  PRIORITY = {
36
36
  :normal => 'Normal',
@@ -39,7 +39,7 @@ module Rev
39
39
 
40
40
  # @param payment [Payment] payment info
41
41
  # @param fields [Hash] of fields to initialize instance. See instance attributes for available fields.
42
- # @deprecated payment always defaults to :accoount_balance
42
+ # @deprecated payment always defaults to :account_balance
43
43
  def self.new_with_payment(payment, fields = {})
44
44
  fields = { :priority => PRIORITY[:normal] }.merge(fields)
45
45
  super fields
@@ -75,7 +75,7 @@ module Rev
75
75
  class << self
76
76
  def with_account_balance()
77
77
  Payment::new(TYPES[:account_balance])
78
- end
78
+ end
79
79
  end
80
80
  end
81
81
 
@@ -98,7 +98,7 @@ module Rev
98
98
  end
99
99
 
100
100
  private
101
-
101
+
102
102
  def validate_inputs(inputs)
103
103
  !inputs.nil? && inputs.length > 0
104
104
  end
@@ -106,7 +106,7 @@ module Rev
106
106
 
107
107
  # Transcription options. This section contains the input media that must be transferred to our servers
108
108
  # using a POST to /inputs, and are referenced using the URIs returned by that call. We also support external links.
109
- # @see http://www.rev.com/api/ordersposttranscription
109
+ # @see https://www.rev.com/api/ordersposttranscription
110
110
  class TranscriptionOptions < InputOptions
111
111
  # Optional, should we transcribe the provided files verbatim? If true,
112
112
  # all filler words (i.e. umm, huh) will be included.
@@ -118,7 +118,7 @@ module Rev
118
118
  # @param inputs [Array] list of inputs
119
119
  # @param info [Hash] of fields to initialize instance. May contain:
120
120
  # - :verbatim => true/false
121
- # - :timestams => true/false
121
+ # - :timestamps => true/false
122
122
  def initialize(inputs, info = {})
123
123
  super inputs, info
124
124
  end
@@ -128,7 +128,7 @@ module Rev
128
128
  # servers using a POST to /inputs, and are referenced using the URIs returned by that call.
129
129
  # For each media, word count must be specified. The language code for the source and desitination
130
130
  # languages must also be specified.
131
- # @see http://www.rev.com/api/ordersposttranslation
131
+ # @see https://www.rev.com/api/ordersposttranslation
132
132
  class TranslationOptions < InputOptions
133
133
  # Mandatory, source language code
134
134
  attr_reader :source_language_code
@@ -145,10 +145,10 @@ module Rev
145
145
  super inputs, info
146
146
  end
147
147
  end
148
-
148
+
149
149
  # Caption options. This section contains the input media that must be transferred to our servers
150
150
  # using a POST to /inputs, and are referenced using the URIs returned by that call. We also support external links.
151
- # @see http://www.rev.com/api/orderspostcaption
151
+ # @see https://www.rev.com/api/orderspostcaption
152
152
  class CaptionOptions < InputOptions
153
153
  # Array of file formats the captions should be delivered as. (Optional, default is SubRip)
154
154
  attr_reader :output_file_formats
@@ -160,14 +160,14 @@ module Rev
160
160
  :ttml => 'Ttml',
161
161
  :qttext => 'QTtext'
162
162
  }
163
-
163
+
164
164
  def initialize(inputs, info = {})
165
165
  super(inputs, info)
166
166
  raise(ArgumentError, "invalid format(s)") unless validate_output_formats(info[:output_file_formats])
167
167
  end
168
-
168
+
169
169
  private
170
-
170
+
171
171
  def validate_output_formats(formats)
172
172
  formats.nil? || formats.select{|f| !OUTPUT_FILE_FORMATS.has_value?(f) }.empty?
173
173
  end
@@ -181,7 +181,7 @@ module Rev
181
181
  # Length of audio in seconds (mandatory in case of inability to determine it automatically).
182
182
  # Used within {Rev::OrderRequest::TranscriptionInfo}
183
183
  attr_reader :audio_length_seconds
184
-
184
+
185
185
  # Length of video in seconds (mandatory in case of inability to determine it automatically).
186
186
  # Used within {Rev::OrderRequest::CaptionInfo}
187
187
  attr_reader :video_length_seconds
@@ -1,3 +1,3 @@
1
1
  module Rev
2
- VERSION = '2.0.0'
2
+ VERSION = '2.0.1'
3
3
  end
@@ -11,7 +11,7 @@ Gem::Specification.new do |s|
11
11
  s.description = "Communicate with Rev.com API using plain Ruby objects without bothering about HTTP"
12
12
  s.authors = ["Rev.com, Inc"]
13
13
  s.email = 'api@rev.com'
14
- s.homepage = 'http://www.rev.com/api'
14
+ s.homepage = 'https://www.rev.com/api'
15
15
  s.license = 'Apache License 2.0'
16
16
 
17
17
  s.files = `git ls-files`.split("\n")
@@ -0,0 +1,41 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://www.revtrunk.com/api/v1/orders?clientRef=my%20ref&page=0
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Authorization:
11
+ - Rev welcome:AAAAAu/YjZ3phXU5FsF35yIcgiA=
12
+ User-Agent:
13
+ - RevOfficialRubySDK/2.0.0
14
+ response:
15
+ status:
16
+ code: 200
17
+ message: OK
18
+ headers:
19
+ Cache-Control:
20
+ - no-cache
21
+ Pragma:
22
+ - no-cache
23
+ Content-Length:
24
+ - '271'
25
+ Content-Type:
26
+ - application/json; charset=utf-8
27
+ Expires:
28
+ - "-1"
29
+ Server:
30
+ - Microsoft-IIS/8.5
31
+ X-Powered-By:
32
+ - ASP.NET
33
+ Date:
34
+ - Thu, 13 Aug 2015 22:33:40 GMT
35
+ body:
36
+ encoding: UTF-8
37
+ string: '{"total_count":1,"results_per_page":25,"page":0,"orders":[{"order_number":"CP0180436196","client_ref":"4410704484001","price":2.4000,"status":"Finding
38
+ Captioner","priority":"Normal","caption":{"total_length":2,"total_length_seconds":144},"comments":[],"attachments":[]}]}'
39
+ http_version:
40
+ recorded_at: Thu, 13 Aug 2015 22:33:40 GMT
41
+ recorded_with: VCR 2.9.3
@@ -5,7 +5,7 @@ http_interactions:
5
5
  uri: https://www.revtrunk.com/api/v1/inputs
6
6
  body:
7
7
  encoding: UTF-8
8
- string: ! '{"url":"http://www.rev.com/content/img/rev/rev_logo_colored_top.png"}'
8
+ string: ! '{"url":"https://www.rev.com/content/img/rev/rev_logo_colored_top.png"}'
9
9
  headers:
10
10
  Content-Type:
11
11
  - application/json
@@ -39,6 +39,6 @@ http_interactions:
39
39
  body:
40
40
  encoding: US-ASCII
41
41
  string: ''
42
- http_version:
42
+ http_version:
43
43
  recorded_at: Tue, 17 Sep 2013 21:08:37 GMT
44
44
  recorded_with: VCR 2.5.0
@@ -5,7 +5,7 @@ http_interactions:
5
5
  uri: https://www.revtrunk.com/api/v1/inputs
6
6
  body:
7
7
  encoding: UTF-8
8
- string: ! '{"url":"http://www.rev.com/content/img/rev/rev_logo_colored_top.png","filename":"sourcedocument.png","content_type":"image/png"}'
8
+ string: ! '{"url":"https://www.rev.com/content/img/rev/rev_logo_colored_top.png","filename":"sourcedocument.png","content_type":"image/png"}'
9
9
  headers:
10
10
  Content-Type:
11
11
  - application/json
@@ -39,6 +39,6 @@ http_interactions:
39
39
  body:
40
40
  encoding: US-ASCII
41
41
  string: ''
42
- http_version:
42
+ http_version:
43
43
  recorded_at: Tue, 17 Sep 2013 21:11:45 GMT
44
44
  recorded_with: VCR 2.5.0
@@ -33,6 +33,29 @@ describe 'GET /orders' do
33
33
  end
34
34
  end
35
35
 
36
+ describe 'GET /orders without client reference raises' do
37
+ it 'must raise NotAcceptableError' do
38
+ assert_raises(ArgumentError) { client.get_orders_by_client_ref }
39
+ end
40
+ end
41
+
42
+ describe 'GET /orders?page=0&clientRef={client_ref}' do
43
+ it 'must load order with given reference id' do
44
+ VCR.insert_cassette 'get_orders_with_clientRef'
45
+
46
+ page = client.get_orders_by_client_ref('my ref')
47
+
48
+ assert_requested :get, /.*\/api\/v1\/orders\?clientRef=my%20ref&page=0/, :times => 1
49
+
50
+ page.orders.must_be_instance_of Array
51
+ page.results_per_page.must_equal 25
52
+ page.orders.size.must_equal 1
53
+ page.page.must_equal 0
54
+ page.total_count.must_equal 1
55
+ page.orders[0].order_number.must_equal 'CP0180436196'
56
+ end
57
+ end
58
+
36
59
  after do
37
60
  VCR.eject_cassette
38
61
  end
@@ -27,6 +27,6 @@ describe Rev::HttpClient do
27
27
  'Authorization' => "Rev foo:bar",
28
28
  'User-Agent' => Rev::HttpClient::USER_AGENT
29
29
  }
30
- end
30
+ end
31
31
  end
32
32
 
@@ -6,7 +6,7 @@ describe 'POST /inputs' do
6
6
  it 'must link external file with explicit content-type and file' do
7
7
  VCR.insert_cassette 'link_input_with_all_attributes'
8
8
 
9
- link = 'http://www.rev.com/content/img/rev/rev_logo_colored_top.png'
9
+ link = 'https://www.rev.com/content/img/rev/rev_logo_colored_top.png'
10
10
  filename = 'sourcedocument.png'
11
11
  content_type = 'image/png'
12
12
  new_input_location = client.create_input_from_link(link, filename, content_type)
@@ -27,7 +27,7 @@ describe 'POST /inputs' do
27
27
  it 'must link external file without content-type and filename' do
28
28
  VCR.insert_cassette 'link_input'
29
29
 
30
- link = 'http://www.rev.com/content/img/rev/rev_logo_colored_top.png'
30
+ link = 'https://www.rev.com/content/img/rev/rev_logo_colored_top.png'
31
31
  new_input_location = client.create_input_from_link(link)
32
32
 
33
33
  new_input_location.must_match 'urn:foxtranslate:inputmedia:'
metadata CHANGED
@@ -1,155 +1,155 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rev-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Rev.com, Inc
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-27 00:00:00.000000000 Z
11
+ date: 2015-09-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ~>
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0.11'
20
- - - ">="
20
+ - - '>='
21
21
  - !ruby/object:Gem::Version
22
22
  version: 0.11.0
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
- - - "~>"
27
+ - - ~>
28
28
  - !ruby/object:Gem::Version
29
29
  version: '0.11'
30
- - - ">="
30
+ - - '>='
31
31
  - !ruby/object:Gem::Version
32
32
  version: 0.11.0
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: webmock
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
- - - "~>"
37
+ - - ~>
38
38
  - !ruby/object:Gem::Version
39
39
  version: '1.11'
40
- - - "~>"
40
+ - - ~>
41
41
  - !ruby/object:Gem::Version
42
42
  version: 1.11.0
43
43
  type: :development
44
44
  prerelease: false
45
45
  version_requirements: !ruby/object:Gem::Requirement
46
46
  requirements:
47
- - - "~>"
47
+ - - ~>
48
48
  - !ruby/object:Gem::Version
49
49
  version: '1.11'
50
- - - "~>"
50
+ - - ~>
51
51
  - !ruby/object:Gem::Version
52
52
  version: 1.11.0
53
53
  - !ruby/object:Gem::Dependency
54
54
  name: vcr
55
55
  requirement: !ruby/object:Gem::Requirement
56
56
  requirements:
57
- - - "~>"
57
+ - - ~>
58
58
  - !ruby/object:Gem::Version
59
59
  version: '2.6'
60
- - - "~>"
60
+ - - ~>
61
61
  - !ruby/object:Gem::Version
62
62
  version: 2.6.0
63
63
  type: :development
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
- - - "~>"
67
+ - - ~>
68
68
  - !ruby/object:Gem::Version
69
69
  version: '2.6'
70
- - - "~>"
70
+ - - ~>
71
71
  - !ruby/object:Gem::Version
72
72
  version: 2.6.0
73
73
  - !ruby/object:Gem::Dependency
74
74
  name: turn
75
75
  requirement: !ruby/object:Gem::Requirement
76
76
  requirements:
77
- - - "~>"
77
+ - - ~>
78
78
  - !ruby/object:Gem::Version
79
79
  version: '0.9'
80
- - - "~>"
80
+ - - ~>
81
81
  - !ruby/object:Gem::Version
82
82
  version: 0.9.6
83
83
  type: :development
84
84
  prerelease: false
85
85
  version_requirements: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - "~>"
87
+ - - ~>
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0.9'
90
- - - "~>"
90
+ - - ~>
91
91
  - !ruby/object:Gem::Version
92
92
  version: 0.9.6
93
93
  - !ruby/object:Gem::Dependency
94
94
  name: rake
95
95
  requirement: !ruby/object:Gem::Requirement
96
96
  requirements:
97
- - - "~>"
97
+ - - ~>
98
98
  - !ruby/object:Gem::Version
99
99
  version: '10.1'
100
- - - ">="
100
+ - - '>='
101
101
  - !ruby/object:Gem::Version
102
102
  version: 10.1.0
103
103
  type: :development
104
104
  prerelease: false
105
105
  version_requirements: !ruby/object:Gem::Requirement
106
106
  requirements:
107
- - - "~>"
107
+ - - ~>
108
108
  - !ruby/object:Gem::Version
109
109
  version: '10.1'
110
- - - ">="
110
+ - - '>='
111
111
  - !ruby/object:Gem::Version
112
112
  version: 10.1.0
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: yard
115
115
  requirement: !ruby/object:Gem::Requirement
116
116
  requirements:
117
- - - "~>"
117
+ - - ~>
118
118
  - !ruby/object:Gem::Version
119
119
  version: '0'
120
120
  type: :development
121
121
  prerelease: false
122
122
  version_requirements: !ruby/object:Gem::Requirement
123
123
  requirements:
124
- - - "~>"
124
+ - - ~>
125
125
  - !ruby/object:Gem::Version
126
126
  version: '0'
127
127
  - !ruby/object:Gem::Dependency
128
128
  name: redcarpet
129
129
  requirement: !ruby/object:Gem::Requirement
130
130
  requirements:
131
- - - ">="
131
+ - - '>='
132
132
  - !ruby/object:Gem::Version
133
133
  version: '0'
134
134
  type: :development
135
135
  prerelease: false
136
136
  version_requirements: !ruby/object:Gem::Requirement
137
137
  requirements:
138
- - - ">="
138
+ - - '>='
139
139
  - !ruby/object:Gem::Version
140
140
  version: '0'
141
141
  - !ruby/object:Gem::Dependency
142
142
  name: rubygems-tasks
143
143
  requirement: !ruby/object:Gem::Requirement
144
144
  requirements:
145
- - - "~>"
145
+ - - ~>
146
146
  - !ruby/object:Gem::Version
147
147
  version: '0'
148
148
  type: :development
149
149
  prerelease: false
150
150
  version_requirements: !ruby/object:Gem::Requirement
151
151
  requirements:
152
- - - "~>"
152
+ - - ~>
153
153
  - !ruby/object:Gem::Version
154
154
  version: '0'
155
155
  description: Communicate with Rev.com API using plain Ruby objects without bothering
@@ -159,11 +159,11 @@ executables: []
159
159
  extensions: []
160
160
  extra_rdoc_files: []
161
161
  files:
162
- - ".coveralls.yml"
163
- - ".gitignore"
164
- - ".ruby-gemset"
165
- - ".ruby-version"
166
- - ".travis.yml"
162
+ - .coveralls.yml
163
+ - .gitignore
164
+ - .ruby-gemset
165
+ - .ruby-version
166
+ - .travis.yml
167
167
  - Gemfile
168
168
  - Gemfile.lock
169
169
  - LICENSE
@@ -190,6 +190,7 @@ files:
190
190
  - spec/fixtures/api_cassettes/get_attachment_metadata.yml
191
191
  - spec/fixtures/api_cassettes/get_attachment_with_invalid_id.yml
192
192
  - spec/fixtures/api_cassettes/get_orders.yml
193
+ - spec/fixtures/api_cassettes/get_orders_with_clientRef.yml
193
194
  - spec/fixtures/api_cassettes/get_tc_order.yml
194
195
  - spec/fixtures/api_cassettes/get_third_page_of_orders.yml
195
196
  - spec/fixtures/api_cassettes/get_tr_order.yml
@@ -218,7 +219,8 @@ files:
218
219
  - spec/lib/rev/post_inputs_spec.rb
219
220
  - spec/lib/rev/post_order_spec.rb
220
221
  - spec/spec_helper.rb
221
- homepage: http://www.rev.com/api
222
+ - spec/tmp_get_attachment_content
223
+ homepage: https://www.rev.com/api
222
224
  licenses:
223
225
  - Apache License 2.0
224
226
  metadata: {}
@@ -229,17 +231,17 @@ require_paths:
229
231
  - spec
230
232
  required_ruby_version: !ruby/object:Gem::Requirement
231
233
  requirements:
232
- - - ">="
234
+ - - '>='
233
235
  - !ruby/object:Gem::Version
234
236
  version: 1.9.3
235
237
  required_rubygems_version: !ruby/object:Gem::Requirement
236
238
  requirements:
237
- - - ">="
239
+ - - '>='
238
240
  - !ruby/object:Gem::Version
239
241
  version: '0'
240
242
  requirements: []
241
243
  rubyforge_project:
242
- rubygems_version: 2.2.2
244
+ rubygems_version: 2.4.6
243
245
  signing_key:
244
246
  specification_version: 4
245
247
  summary: Ruby wrapper for Rev.com API
@@ -255,6 +257,7 @@ test_files:
255
257
  - spec/fixtures/api_cassettes/get_attachment_metadata.yml
256
258
  - spec/fixtures/api_cassettes/get_attachment_with_invalid_id.yml
257
259
  - spec/fixtures/api_cassettes/get_orders.yml
260
+ - spec/fixtures/api_cassettes/get_orders_with_clientRef.yml
258
261
  - spec/fixtures/api_cassettes/get_tc_order.yml
259
262
  - spec/fixtures/api_cassettes/get_third_page_of_orders.yml
260
263
  - spec/fixtures/api_cassettes/get_tr_order.yml
@@ -283,4 +286,5 @@ test_files:
283
286
  - spec/lib/rev/post_inputs_spec.rb
284
287
  - spec/lib/rev/post_order_spec.rb
285
288
  - spec/spec_helper.rb
289
+ - spec/tmp_get_attachment_content
286
290
  has_rdoc: yard