Class: AdvancedBilling::MetafieldScope
- Inherits:
-
BaseModel
- Object
- CoreLibrary::BaseModel
- BaseModel
- AdvancedBilling::MetafieldScope
- Defined in:
- lib/advanced_billing/models/metafield_scope.rb
Overview
Warning: When updating a metafield’s scope attribute, all scope attributes must be passed. Partially complete scope attributes will override the existing settings.
Instance Attribute Summary collapse
-
#csv ⇒ IncludeOption
Include (1) or exclude (0) metafields from the csv export.
-
#hosted ⇒ Array[String]
Include (1) or exclude (0) metafields from being edited by your ecosystem.
-
#invoices ⇒ IncludeOption
Include (1) or exclude (0) metafields from invoices.
-
#portal ⇒ IncludeOption
Include (1) or exclude (0) metafields from the portal.
-
#public_edit ⇒ IncludeOption
Include (1) or exclude (0) metafields from being edited by your ecosystem.
-
#public_show ⇒ IncludeOption
Include (1) or exclude (0) metafields from being viewable by your ecosystem.
-
#statements ⇒ IncludeOption
Include (1) or exclude (0) metafields from statements.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
-
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
Instance Method Summary collapse
-
#initialize(csv: SKIP, invoices: SKIP, statements: SKIP, portal: SKIP, public_show: SKIP, public_edit: SKIP, hosted: SKIP, additional_properties: {}) ⇒ MetafieldScope
constructor
A new instance of MetafieldScope.
Methods inherited from BaseModel
Constructor Details
#initialize(csv: SKIP, invoices: SKIP, statements: SKIP, portal: SKIP, public_show: SKIP, public_edit: SKIP, hosted: SKIP, additional_properties: {}) ⇒ MetafieldScope
Returns a new instance of MetafieldScope.
74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/advanced_billing/models/metafield_scope.rb', line 74 def initialize(csv: SKIP, invoices: SKIP, statements: SKIP, portal: SKIP, public_show: SKIP, public_edit: SKIP, hosted: SKIP, additional_properties: {}) @csv = csv unless csv == SKIP @invoices = invoices unless invoices == SKIP @statements = statements unless statements == SKIP @portal = portal unless portal == SKIP @public_show = public_show unless public_show == SKIP @public_edit = public_edit unless public_edit == SKIP @hosted = hosted unless hosted == SKIP # Add additional model properties to the instance. additional_properties.each do |_name, _value| instance_variable_set("@#{_name}", _value) end end |
Instance Attribute Details
#csv ⇒ IncludeOption
Include (1) or exclude (0) metafields from the csv export.
16 17 18 |
# File 'lib/advanced_billing/models/metafield_scope.rb', line 16 def csv @csv end |
#hosted ⇒ Array[String]
Include (1) or exclude (0) metafields from being edited by your ecosystem.
41 42 43 |
# File 'lib/advanced_billing/models/metafield_scope.rb', line 41 def hosted @hosted end |
#invoices ⇒ IncludeOption
Include (1) or exclude (0) metafields from invoices.
20 21 22 |
# File 'lib/advanced_billing/models/metafield_scope.rb', line 20 def invoices @invoices end |
#portal ⇒ IncludeOption
Include (1) or exclude (0) metafields from the portal.
28 29 30 |
# File 'lib/advanced_billing/models/metafield_scope.rb', line 28 def portal @portal end |
#public_edit ⇒ IncludeOption
Include (1) or exclude (0) metafields from being edited by your ecosystem.
37 38 39 |
# File 'lib/advanced_billing/models/metafield_scope.rb', line 37 def public_edit @public_edit end |
#public_show ⇒ IncludeOption
Include (1) or exclude (0) metafields from being viewable by your ecosystem.
33 34 35 |
# File 'lib/advanced_billing/models/metafield_scope.rb', line 33 def public_show @public_show end |
#statements ⇒ IncludeOption
Include (1) or exclude (0) metafields from statements.
24 25 26 |
# File 'lib/advanced_billing/models/metafield_scope.rb', line 24 def statements @statements end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a 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 |
# File 'lib/advanced_billing/models/metafield_scope.rb', line 92 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. csv = hash.key?('csv') ? hash['csv'] : SKIP invoices = hash.key?('invoices') ? hash['invoices'] : SKIP statements = hash.key?('statements') ? hash['statements'] : SKIP portal = hash.key?('portal') ? hash['portal'] : SKIP public_show = hash.key?('public_show') ? hash['public_show'] : SKIP public_edit = hash.key?('public_edit') ? hash['public_edit'] : SKIP hosted = hash.key?('hosted') ? hash['hosted'] : SKIP # Clean out expected properties from Hash. names.each_value { |k| hash.delete(k) } # Create object from extracted values. MetafieldScope.new(csv: csv, invoices: invoices, statements: statements, portal: portal, public_show: public_show, public_edit: public_edit, hosted: hosted, additional_properties: hash) end |
.names ⇒ Object
A mapping from model property names to API property names.
44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/advanced_billing/models/metafield_scope.rb', line 44 def self.names @_hash = {} if @_hash.nil? @_hash['csv'] = 'csv' @_hash['invoices'] = 'invoices' @_hash['statements'] = 'statements' @_hash['portal'] = 'portal' @_hash['public_show'] = 'public_show' @_hash['public_edit'] = 'public_edit' @_hash['hosted'] = 'hosted' @_hash end |
.nullables ⇒ Object
An array for nullable fields
70 71 72 |
# File 'lib/advanced_billing/models/metafield_scope.rb', line 70 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/advanced_billing/models/metafield_scope.rb', line 57 def self.optionals %w[ csv invoices statements portal public_show public_edit hosted ] end |
.validate(value) ⇒ Object
Validates an instance of the object from a given value.
120 121 122 123 124 125 126 |
# File 'lib/advanced_billing/models/metafield_scope.rb', line 120 def self.validate(value) return true if value.instance_of? self return false unless value.instance_of? Hash true end |