Module: Conduit::Core::Driver
- Defined in:
- lib/conduit/core/driver.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#action(action_name) ⇒ Object
Set available actions.
-
#actions ⇒ Object
Storage array for required credentials.
-
#credentials ⇒ Object
Storage array for required credentials.
-
#optional_attributes(*args) ⇒ Object
Set optional attributes Useful for specifying overrides and other attributes that MAY be set for every request.
-
#permitted_attributes ⇒ Object
Storage array for permitted attributes.
-
#required_attributes(*args) ⇒ Object
Set required attributes Useful for specifying attributes that MUST be set for every request.
-
#required_credentials(*args) ⇒ Object
Set required credentials.
Class Method Details
.extended(base) ⇒ Object
25 26 27 28 |
# File 'lib/conduit/core/driver.rb', line 25 def self.extended(base) base.instance_variable_set("@_driver_path", File.dirname(caller.first[/^[^:]+/])) end |
Instance Method Details
#action(action_name) ⇒ Object
Set available actions
e.g.
> action :purchase
73 74 75 76 77 |
# File 'lib/conduit/core/driver.rb', line 73 def action(action_name) require File.join(@_driver_path, "actions", action_name.to_s) require File.join(@_driver_path, "parsers", action_name.to_s) actions << action_name end |
#actions ⇒ Object
Storage array for required credentials
e.g. Conduit::Driver::Fusion.actions
> [:purchase]
105 106 107 |
# File 'lib/conduit/core/driver.rb', line 105 def actions @actions ||= Set.new end |
#credentials ⇒ Object
Storage array for required credentials
e.g. Conduit::Driver::Fusion.credentials
> [:foo, :bar, :baz]
85 86 87 |
# File 'lib/conduit/core/driver.rb', line 85 def credentials @credentials ||= Set.new end |
#optional_attributes(*args) ⇒ Object
Set optional attributes Useful for specifying overrides and other attributes that MAY be set for every request.
e.g. optional_attributes :quux
> <Set :quux>
62 63 64 65 66 |
# File 'lib/conduit/core/driver.rb', line 62 def optional_attributes(*args) optional_attribute_set.tap do |attrs| attrs.merge(args) end end |
#permitted_attributes ⇒ Object
Storage array for permitted attributes
e.g. Conduit::Driver::Fusion.permitted_attributes
> <Set :bar, :baz, :quuz>
95 96 97 |
# File 'lib/conduit/core/driver.rb', line 95 def permitted_attributes required_attribute_set + optional_attribute_set end |
#required_attributes(*args) ⇒ Object
Set required attributes Useful for specifying attributes that MUST be set for every request.
e.g. required_attributes :foo, :bar, :baz
> <Set :bar, :baz>
47 48 49 50 51 |
# File 'lib/conduit/core/driver.rb', line 47 def required_attributes(*args) required_attribute_set.tap do |attrs| attrs.merge(args) end end |
#required_credentials(*args) ⇒ Object
Set required credentials
e.g.
> required_credentials :foo, :bar, :baz
35 36 37 |
# File 'lib/conduit/core/driver.rb', line 35 def required_credentials(*args) credentials.merge(args) end |