Class: NeverBounce::API::Request::JobsCreate
- Inherits:
-
Base
- Object
- Base
- NeverBounce::API::Request::JobsCreate
show all
- Defined in:
- lib/never_bounce/api/request/jobs_create.rb
Instance Attribute Summary collapse
Attributes inherited from Base
#api_key, #api_url, #api_version, #headers, #user_agent
Class Method Summary
collapse
Instance Method Summary
collapse
Methods inherited from Base
#to_curl, #to_httparty
Instance Attribute Details
#allow_manual_review ⇒ Boolean
30
31
32
|
# File 'lib/never_bounce/api/request/jobs_create.rb', line 30
def allow_manual_review
@allow_manual_review
end
|
#auto_parse ⇒ Boolean
7
8
9
|
# File 'lib/never_bounce/api/request/jobs_create.rb', line 7
def auto_parse
@auto_parse
end
|
#auto_start ⇒ Boolean
10
11
12
|
# File 'lib/never_bounce/api/request/jobs_create.rb', line 10
def auto_start
@auto_start
end
|
36
37
38
|
# File 'lib/never_bounce/api/request/jobs_create.rb', line 36
def
@callback_headers
end
|
#callback_url ⇒ String
33
34
35
|
# File 'lib/never_bounce/api/request/jobs_create.rb', line 33
def callback_url
@callback_url
end
|
#filename ⇒ String
13
14
15
|
# File 'lib/never_bounce/api/request/jobs_create.rb', line 13
def filename
@filename
end
|
#historical ⇒ Boolean
27
28
29
|
# File 'lib/never_bounce/api/request/jobs_create.rb', line 27
def historical
@historical
end
|
18
19
20
|
# File 'lib/never_bounce/api/request/jobs_create.rb', line 18
def input
@input
end
|
21
22
23
|
# File 'lib/never_bounce/api/request/jobs_create.rb', line 21
def input_location
@input_location
end
|
#run_sample ⇒ Boolean
24
25
26
|
# File 'lib/never_bounce/api/request/jobs_create.rb', line 24
def run_sample
@run_sample
end
|
Class Method Details
.http_method ⇒ Symbol
43
44
45
|
# File 'lib/never_bounce/api/request/jobs_create.rb', line 43
def self.http_method
:post
end
|
.path ⇒ String
48
49
50
|
# File 'lib/never_bounce/api/request/jobs_create.rb', line 48
def self.path
"jobs/create"
end
|
53
54
55
|
# File 'lib/never_bounce/api/request/jobs_create.rb', line 53
def self.response_klass
Response::JobsCreate
end
|
Instance Method Details
#leverage_historical ⇒ Object
38
39
40
|
# File 'lib/never_bounce/api/request/jobs_create.rb', line 38
def leverage_historical
defined?(@historical) ? @historical : true
end
|
#mode_h ⇒ Hash
Return a ready-to-merge mode attributes hash.
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
# File 'lib/never_bounce/api/request/jobs_create.rb', line 59
def mode_h
@mode_h ||= {}.tap do |_|
unless (v = auto_start).nil?
_[:auto_start] = v
end
unless (v = auto_parse).nil?
_[:auto_parse] = v
end
unless (v = run_sample).nil?
_[:run_sample] = v
end
unless (v = allow_manual_review).nil?
_[:allow_manual_review] = v
end
unless (v = callback_url).nil?
_[:callback_url] = v
end
unless (v = ).nil?
_[:callback_headers] = v
end
unless historical.nil?
_[:request_meta_data] = {leverage_historical_data: leverage_historical}
end
end
end
|
#to_h ⇒ Hash
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
|
# File 'lib/never_bounce/api/request/jobs_create.rb', line 92
def to_h
input = require_attr(:input)
input_location = require_attr(:input_location)
if not ["remote_url", "supplied"].include? input_location
raise AttributeError, "Unknown `input_location`: #{input_location.inspect}"
end
if input_location == "supplied"
raise AttributeError, "Invalid `input` for `input_location` == #{input_location.inspect}: #{input.inspect}" if not input.is_a? Array
input.each do |elem|
em = [AttributeError, "Invalid `input` element: #{elem.inspect}"]
raise(*em) unless elem.is_a? Array
raise(*em) unless elem.map(&:class) == [String, String]
end
end
{
input: input,
input_location: input_location,
filename: require_attr(:filename),
key: require_attr(:api_key),
}.merge(mode_h)
end
|