Class: Merge::Accounting::AvailableActions
- Inherits:
-
Object
- Object
- Merge::Accounting::AvailableActions
- Defined in:
- lib/merge_ruby_client/accounting/types/available_actions.rb
Overview
# The AvailableActions Object
### Description
The `Activity` object is used to see all available model/operation combinations
for an integration.
### Usage Example
Fetch all the actions available for the `Zenefits` integration.
Constant Summary collapse
- OMIT =
Object.new
Instance Attribute Summary collapse
-
#additional_properties ⇒ OpenStruct
readonly
Additional properties unmapped to the current class definition.
- #available_model_operations ⇒ Array<Merge::Accounting::ModelOperation> readonly
- #integration ⇒ Merge::Accounting::AccountIntegration readonly
- #passthrough_available ⇒ Boolean readonly
Class Method Summary collapse
-
.from_json(json_object:) ⇒ Merge::Accounting::AvailableActions
Deserialize a JSON object to an instance of AvailableActions.
-
.validate_raw(obj:) ⇒ Void
Leveraged for Union-type generation, validate_raw attempts to parse the given hash and check each fields type against the current object’s property definitions.
Instance Method Summary collapse
- #initialize(integration:, passthrough_available:, available_model_operations: OMIT, additional_properties: nil) ⇒ Merge::Accounting::AvailableActions constructor
-
#to_json(*_args) ⇒ String
Serialize an instance of AvailableActions to a JSON object.
Constructor Details
#initialize(integration:, passthrough_available:, available_model_operations: OMIT, additional_properties: nil) ⇒ Merge::Accounting::AvailableActions
36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/merge_ruby_client/accounting/types/available_actions.rb', line 36 def initialize(integration:, passthrough_available:, available_model_operations: OMIT, additional_properties: nil) @integration = integration @passthrough_available = passthrough_available @available_model_operations = available_model_operations if available_model_operations != OMIT @additional_properties = additional_properties @_field_set = { "integration": integration, "passthrough_available": passthrough_available, "available_model_operations": available_model_operations }.reject do |_k, v| v == OMIT end end |
Instance Attribute Details
#additional_properties ⇒ OpenStruct (readonly)
Returns Additional properties unmapped to the current class definition.
24 25 26 |
# File 'lib/merge_ruby_client/accounting/types/available_actions.rb', line 24 def additional_properties @additional_properties end |
#available_model_operations ⇒ Array<Merge::Accounting::ModelOperation> (readonly)
22 23 24 |
# File 'lib/merge_ruby_client/accounting/types/available_actions.rb', line 22 def available_model_operations @available_model_operations end |
#integration ⇒ Merge::Accounting::AccountIntegration (readonly)
18 19 20 |
# File 'lib/merge_ruby_client/accounting/types/available_actions.rb', line 18 def integration @integration end |
#passthrough_available ⇒ Boolean (readonly)
20 21 22 |
# File 'lib/merge_ruby_client/accounting/types/available_actions.rb', line 20 def passthrough_available @passthrough_available end |
Class Method Details
.from_json(json_object:) ⇒ Merge::Accounting::AvailableActions
Deserialize a JSON object to an instance of AvailableActions
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
# File 'lib/merge_ruby_client/accounting/types/available_actions.rb', line 54 def self.from_json(json_object:) struct = JSON.parse(json_object, object_class: OpenStruct) parsed_json = JSON.parse(json_object) if parsed_json["integration"].nil? integration = nil else integration = parsed_json["integration"].to_json integration = Merge::Accounting::AccountIntegration.from_json(json_object: integration) end passthrough_available = parsed_json["passthrough_available"] available_model_operations = parsed_json["available_model_operations"]&.map do |item| item = item.to_json Merge::Accounting::ModelOperation.from_json(json_object: item) end new( integration: integration, passthrough_available: passthrough_available, available_model_operations: available_model_operations, additional_properties: struct ) end |
.validate_raw(obj:) ⇒ Void
Leveraged for Union-type generation, validate_raw attempts to parse the given
hash and check each fields type against the current object's property
definitions.
89 90 91 92 93 |
# File 'lib/merge_ruby_client/accounting/types/available_actions.rb', line 89 def self.validate_raw(obj:) Merge::Accounting::AccountIntegration.validate_raw(obj: obj.integration) obj.passthrough_available.is_a?(Boolean) != false || raise("Passed value for field obj.passthrough_available is not the expected type, validation failed.") obj.available_model_operations&.is_a?(Array) != false || raise("Passed value for field obj.available_model_operations is not the expected type, validation failed.") end |
Instance Method Details
#to_json(*_args) ⇒ String
Serialize an instance of AvailableActions to a JSON object
79 80 81 |
# File 'lib/merge_ruby_client/accounting/types/available_actions.rb', line 79 def to_json(*_args) @_field_set&.to_json end |