Class: Pdf4me::WrapperAction
- Inherits:
-
Object
- Object
- Pdf4me::WrapperAction
show all
- Includes:
- ActiveModel::Validations
- Defined in:
- lib/pdf4me/actions/wrapper_action.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
Returns a new instance of WrapperAction.
20
21
22
23
|
# File 'lib/pdf4me/actions/wrapper_action.rb', line 20
def initialize(attrs = {})
attributes = defaults.merge(attrs)
assign_attributes(attributes)
end
|
Instance Attribute Details
#client ⇒ Object
Returns the value of attribute client.
7
8
9
|
# File 'lib/pdf4me/actions/wrapper_action.rb', line 7
def client
@client
end
|
Instance Method Details
#assign_attributes(attributes = {}) ⇒ Object
13
14
15
16
17
18
|
# File 'lib/pdf4me/actions/wrapper_action.rb', line 13
def assign_attributes(attributes = {})
attributes.to_h.each do |key, value|
writer_method = "#{key}="
send(writer_method, value) if respond_to?(writer_method)
end
end
|
#defaults ⇒ Object
25
26
27
|
# File 'lib/pdf4me/actions/wrapper_action.rb', line 25
def defaults
{}
end
|
#run ⇒ Object
29
30
31
32
|
# File 'lib/pdf4me/actions/wrapper_action.rb', line 29
def run
return false if invalid?
call_api.success?
end
|
#run! ⇒ Object
34
35
36
37
|
# File 'lib/pdf4me/actions/wrapper_action.rb', line 34
def run!
validate!
call_api.success?
end
|