Method: NeverBounce::API::Client#jobs_create
- Defined in:
- lib/never_bounce/api/client.rb
#jobs_create(auto_parse: false, auto_start: false, filename: nil, remote_input: nil, run_sample: false, supplied_input: nil) ⇒ Response::JobsCreate, Response::ErrorMessage
Make a jobs/create
request.
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'lib/never_bounce/api/client.rb', line 86 def jobs_create(auto_parse: false, auto_start: false, filename: nil, remote_input: nil, run_sample: false, supplied_input: nil) raise ArgumentError, "`remote_input` and `supplied_input` can't both be given" if remote_input && supplied_input input_location = if (v = remote_input) # NOTE: Logical order: type, then value. input = v "remote_url" elsif (v = supplied_input) input = v "supplied" else # NOTE: Not exactly sure what to raise here. From procedure standpoint missing argument is an `ArgumentError`. raise ArgumentError, "Input not given, use `remote_input` or `supplied_input`" end filename ||= Time.now.strftime("%Y%m%d-%H%M%S.csv") response_to(API::Request::JobsCreate.new({ api_key: api_key, auto_parse: auto_parse, auto_start: auto_start, filename: filename, input: input, input_location: input_location, run_sample: run_sample, })) end |