class Bfwd::Notification

Notification

Attributes

ack_enabled[RW]

{ "description" : "If true notifications will continue to be sent until an acknowledgment is received.", "verbs":["POST","PUT","GET"] }

acked[RW]

{ "description" : "The UTC DateTime when the notification was acked if it is ack enabled.", "verbs":["POST","PUT","GET"] }

action[RW]

{ "description" : "The action associated with the notification.", "verbs":["POST","PUT","GET"] }

changed_by[RW]

{ "description" : "ID of the user who last updated the entity.", "verbs":[] }

changes[RW]
created[RW]

{ "description" : "The UTC DateTime when the object was created.", "verbs":[] }

destination_url[RW]

{ "description" : "The URL the notification will be sent to.", "verbs":["POST","PUT","GET"] }

domain[RW]

{ "description" : "The domain of the notification.", "verbs":["POST","PUT","GET"] }

entity[RW]
entity_id[RW]

{ "description" : "The id of the entity associated with the notification.", "verbs":["POST","PUT","GET"] }

final_send_attempt[RW]

{ "description" : "The UTC DateTime of the notification's final send attempt.", "verbs":["POST","PUT","GET"] }

format[RW]

{ "description" : "Format of the notification.", "verbs":["POST","PUT","GET"] }

id[RW]

{ "description" : "ID of the notification.", "verbs":["POST","PUT","GET"] }

last_send_attempt[RW]

{ "description" : "The UTC DateTime of the notifications's last send attempt.", "verbs":["POST","PUT","GET"] }

next_send_attempt[RW]

{ "description" : "The UTC DateTime of the notification's next send attempt.", "verbs":["POST","PUT","GET"] }

organization_id[RW]

{ "description" : "Organization associated with the notification.", "verbs":["POST","PUT","GET"] }

state[RW]

{ "description" : "Whether the notification has been sent.", "verbs":["POST","PUT","GET"] }

total_send_attempts[RW]

{ "description" : "The number of send attempts for this notification.", "verbs":["POST","PUT","GET"] }

updated[RW]

{ "description" : "The UTC DateTime when the object was last updated.", "verbs":[] }

webhook_id[RW]

{ "description" : "Webhook associated with the notification.", "verbs":["POST","PUT","GET"] }

Public Class Methods

attribute_map() click to toggle source

Attribute mapping from ruby-style variable name to JSON key.

# File lib/bf_ruby2/models/notification.rb, line 99
def self.attribute_map
  {
    :'created' => :'created',
    :'changed_by' => :'changedBy',
    :'updated' => :'updated',
    :'id' => :'id',
    :'domain' => :'domain',
    :'action' => :'action',
    :'organization_id' => :'organizationID',
    :'webhook_id' => :'webhookID',
    :'entity_id' => :'entityID',
    :'destination_url' => :'destinationURL',
    :'format' => :'format',
    :'ack_enabled' => :'ackEnabled',
    :'entity' => :'entity',
    :'changes' => :'changes',
    :'last_send_attempt' => :'lastSendAttempt',
    :'next_send_attempt' => :'nextSendAttempt',
    :'final_send_attempt' => :'finalSendAttempt',
    :'total_send_attempts' => :'totalSendAttempts',
    :'state' => :'state',
    :'acked' => :'acked'
  }
end
new(attributes = {}) click to toggle source

Initializes the object @param [Hash] attributes Model attributes in the form of hash

# File lib/bf_ruby2/models/notification.rb, line 152
def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}

  if attributes.has_key?(:'created')
    self.created = attributes[:'created']
  end

  if attributes.has_key?(:'changedBy')
    self.changed_by = attributes[:'changedBy']
  end

  if attributes.has_key?(:'updated')
    self.updated = attributes[:'updated']
  end

  if attributes.has_key?(:'id')
    self.id = attributes[:'id']
  end

  if attributes.has_key?(:'domain')
    self.domain = attributes[:'domain']
  end

  if attributes.has_key?(:'action')
    self.action = attributes[:'action']
  end

  if attributes.has_key?(:'organizationID')
    self.organization_id = attributes[:'organizationID']
  end

  if attributes.has_key?(:'webhookID')
    self.webhook_id = attributes[:'webhookID']
  end

  if attributes.has_key?(:'entityID')
    self.entity_id = attributes[:'entityID']
  end

  if attributes.has_key?(:'destinationURL')
    self.destination_url = attributes[:'destinationURL']
  end

  if attributes.has_key?(:'format')
    self.format = attributes[:'format']
  end

  if attributes.has_key?(:'ackEnabled')
    self.ack_enabled = attributes[:'ackEnabled']
  else
    self.ack_enabled = false
  end

  if attributes.has_key?(:'entity')
    if (value = attributes[:'entity']).is_a?(Array)
      self.entity = value
    end
  end

  if attributes.has_key?(:'changes')
    if (value = attributes[:'changes']).is_a?(Array)
      self.changes = value
    end
  end

  if attributes.has_key?(:'lastSendAttempt')
    self.last_send_attempt = attributes[:'lastSendAttempt']
  end

  if attributes.has_key?(:'nextSendAttempt')
    self.next_send_attempt = attributes[:'nextSendAttempt']
  end

  if attributes.has_key?(:'finalSendAttempt')
    self.final_send_attempt = attributes[:'finalSendAttempt']
  end

  if attributes.has_key?(:'totalSendAttempts')
    self.total_send_attempts = attributes[:'totalSendAttempts']
  end

  if attributes.has_key?(:'state')
    self.state = attributes[:'state']
  end

  if attributes.has_key?(:'acked')
    self.acked = attributes[:'acked']
  end

end
swagger_types() click to toggle source

Attribute type mapping.

# File lib/bf_ruby2/models/notification.rb, line 125
def self.swagger_types
  {
    :'created' => :'DateTime',
    :'changed_by' => :'String',
    :'updated' => :'DateTime',
    :'id' => :'String',
    :'domain' => :'String',
    :'action' => :'String',
    :'organization_id' => :'String',
    :'webhook_id' => :'String',
    :'entity_id' => :'String',
    :'destination_url' => :'String',
    :'format' => :'String',
    :'ack_enabled' => :'BOOLEAN',
    :'entity' => :'Array<String>',
    :'changes' => :'Array<String>',
    :'last_send_attempt' => :'DateTime',
    :'next_send_attempt' => :'DateTime',
    :'final_send_attempt' => :'DateTime',
    :'total_send_attempts' => :'Integer',
    :'state' => :'String',
    :'acked' => :'DateTime'
  }
end

Public Instance Methods

==(o) click to toggle source

Checks equality by comparing each attribute. @param [Object] Object to be compared

# File lib/bf_ruby2/models/notification.rb, line 354
def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      created == o.created &&
      changed_by == o.changed_by &&
      updated == o.updated &&
      id == o.id &&
      domain == o.domain &&
      action == o.action &&
      organization_id == o.organization_id &&
      webhook_id == o.webhook_id &&
      entity_id == o.entity_id &&
      destination_url == o.destination_url &&
      format == o.format &&
      ack_enabled == o.ack_enabled &&
      entity == o.entity &&
      changes == o.changes &&
      last_send_attempt == o.last_send_attempt &&
      next_send_attempt == o.next_send_attempt &&
      final_send_attempt == o.final_send_attempt &&
      total_send_attempts == o.total_send_attempts &&
      state == o.state &&
      acked == o.acked
end
_deserialize(type, value) click to toggle source

Deserializes the data based on type @param string type Data type @param string value Value to be deserialized @return [Object] Deserialized data

# File lib/bf_ruby2/models/notification.rb, line 415
def _deserialize(type, value)
  case type.to_sym
  when :DateTime
    DateTime.parse(value)
  when :Date
    Date.parse(value)
  when :String
    value.to_s
  when :Integer
    value.to_i
  when :Float
    value.to_f
  when :BOOLEAN
    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
      true
    else
      false
    end
  when :Object
    # generic object (usually a Hash), return directly
    value
  when /\AArray<(?<inner_type>.+)>\z/
    inner_type = Regexp.last_match[:inner_type]
    value.map { |v| _deserialize(inner_type, v) }
  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
    k_type = Regexp.last_match[:k_type]
    v_type = Regexp.last_match[:v_type]
    {}.tap do |hash|
      value.each do |k, v|
        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
      end
    end
  else # model
    temp_model = Bfwd.const_get(type).new
    temp_model.build_from_hash(value)
  end
end
_to_hash(value) click to toggle source

Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value @param [Object] value Any valid value @return [Hash] Returns the value in the form of hash

# File lib/bf_ruby2/models/notification.rb, line 481
def _to_hash(value)
  if value.is_a?(Array)
    value.compact.map{ |v| _to_hash(v) }
  elsif value.is_a?(Hash)
    {}.tap do |hash|
      value.each { |k, v| hash[k] = _to_hash(v) }
    end
  elsif value.respond_to? :to_hash
    value.to_hash
  else
    value
  end
end
action=(action) click to toggle source

Custom attribute writer method checking allowed values (enum). @param [Object] action Object to be assigned

# File lib/bf_ruby2/models/notification.rb, line 324
def action=(action)
  validator = EnumAttributeValidator.new('String', ["Accept", "Active", "AwaitingPayment", "AwaitingRefund", "Cancelled", "Completed", "Created", "Error", "Expiring", "Expired", "Failed", "Migrated", "NeedsAmendments", "Paid", "Pending", "Provisioned", "Refunded", "Reject", "Trial", "Unknown", "Unpaid", "Updated", "Voided", "PaymentFailed"])
  unless validator.valid?(action)
    fail ArgumentError, "invalid value for 'action', must be one of #{validator.allowable_values}."
  end
  @action = action
end
build_from_hash(attributes) click to toggle source

Builds the object from hash @param [Hash] attributes Model attributes in the form of hash @return [Object] Returns the model itself

# File lib/bf_ruby2/models/notification.rb, line 394
def build_from_hash(attributes)
  return nil unless attributes.is_a?(Hash)
  self.class.swagger_types.each_pair do |key, type|
    if type =~ /\AArray<(.*)>/i
      # check to ensure the input is an array given that the the attribute
      # is documented as an array but the input is not
      if attributes[self.class.attribute_map[key]].is_a?(Array)
        self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
      end
    elsif !attributes[self.class.attribute_map[key]].nil?
      self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
    end # or else data not found in attributes(hash), not an issue as the data can be optional
  end

  self
end
domain=(domain) click to toggle source

Custom attribute writer method checking allowed values (enum). @param [Object] domain Object to be assigned

# File lib/bf_ruby2/models/notification.rb, line 314
def domain=(domain)
  validator = EnumAttributeValidator.new('String', ["Notification", "Organization", "OrganizationGateway", "Product", "User", "Subscription", "Profile", "ProductRatePlan", "Client", "Invoice", "PricingComponentValue", "Account", "PricingComponentValueChange", "PricingComponentTier", "PricingComponent", "PricingCalculation", "Coupon", "CouponDiscount", "CouponDefinition", "CouponInstance", "CouponModifier", "CouponRule", "CouponBookDefinition", "CouponBook", "InvoiceLine", "Webhook", "WebhookSubscription", "SubscriptionCancellation", "NotificationSnapshot", "InvoicePayment", "Payment", "PaymentMethod", "PaymentMethodSubscriptionLink", "DunningLine", "CybersourceToken", "Card", "Alias", "PaypalSimplePaymentReconciliation", "FreePaymentReconciliation", "LocustworldPaymentReconciliation", "CouponInstanceExistingValue", "TaxLine", "TaxationStrategy", "TaxationLink", "Address", "AmendmentPriceNTime", "Authority", "UnitOfMeasure", "SearchResult", "Amendment", "AuditLog", "Password", "Username", "FixedTermDefinition", "FixedTerm", "Refund", "CreditNote", "Receipt", "AmendmentCompoundConstituent", "APIConfiguration", "StripeToken", "BraintreeToken", "BalancedToken", "AuthorizeNetToken", "PaypalToken", "SpreedlyToken", "SagePayToken", "TrustCommerceToken", "PayVisionToken", "SagePayOutstandingTransaction", "SagePayEnabledCardType", "SagePayTransaction", "GatewayRevenue", "Migration", "AdhocSubscription", "SubscriptionCharge", "ComponentChange", "Verification", "UsageRoundingStrategies", "PricingComponentValueMigrationChargeAmendmentMapping", "AmendmentDiscardAmendment", "EntityTime", "AggregatingComponent", "PricingComponentMigrationValue", "MetadataKeyValue", "Metadata", "AggregationLink", "BFPermission", "Role", "PermissionLink", "PayVisionTransaction", "KashToken", "DataSynchronizationJob", "DataSynchronizationJobError", "DataSynchronizationConfiguration", "DataSynchronizationAppConfiguration", "AggregationChildrenResponse", "InvoiceLinePayment", "EmailSubscription", "EmailProvider", "TimeResponse", "Email", "RevenueAttribution", "Unknown"])
  unless validator.valid?(domain)
    fail ArgumentError, "invalid value for 'domain', must be one of #{validator.allowable_values}."
  end
  @domain = domain
end
eql?(o) click to toggle source

@see the `==` method @param [Object] Object to be compared

# File lib/bf_ruby2/models/notification.rb, line 381
def eql?(o)
  self == o
end
format=(format) click to toggle source

Custom attribute writer method checking allowed values (enum). @param [Object] format Object to be assigned

# File lib/bf_ruby2/models/notification.rb, line 334
def format=(format)
  validator = EnumAttributeValidator.new('String', ["JSON", "XML"])
  unless validator.valid?(format)
    fail ArgumentError, "invalid value for 'format', must be one of #{validator.allowable_values}."
  end
  @format = format
end
hash() click to toggle source

Calculates hash code according to all attributes. @return [Fixnum] Hash code

# File lib/bf_ruby2/models/notification.rb, line 387
def hash
  [created, changed_by, updated, id, domain, action, organization_id, webhook_id, entity_id, destination_url, format, ack_enabled, entity, changes, last_send_attempt, next_send_attempt, final_send_attempt, total_send_attempts, state, acked].hash
end
list_invalid_properties() click to toggle source

Show invalid properties with the reasons. Usually used together with valid? @return Array for valid properies with the reasons

# File lib/bf_ruby2/models/notification.rb, line 248
def list_invalid_properties
  invalid_properties = Array.new
  if @domain.nil?
    invalid_properties.push("invalid value for 'domain', domain cannot be nil.")
  end

  if @action.nil?
    invalid_properties.push("invalid value for 'action', action cannot be nil.")
  end

  if @organization_id.nil?
    invalid_properties.push("invalid value for 'organization_id', organization_id cannot be nil.")
  end

  if @webhook_id.nil?
    invalid_properties.push("invalid value for 'webhook_id', webhook_id cannot be nil.")
  end

  if @entity_id.nil?
    invalid_properties.push("invalid value for 'entity_id', entity_id cannot be nil.")
  end

  if @destination_url.nil?
    invalid_properties.push("invalid value for 'destination_url', destination_url cannot be nil.")
  end

  if @format.nil?
    invalid_properties.push("invalid value for 'format', format cannot be nil.")
  end

  if @ack_enabled.nil?
    invalid_properties.push("invalid value for 'ack_enabled', ack_enabled cannot be nil.")
  end

  if @state.nil?
    invalid_properties.push("invalid value for 'state', state cannot be nil.")
  end

  return invalid_properties
end
state=(state) click to toggle source

Custom attribute writer method checking allowed values (enum). @param [Object] state Object to be assigned

# File lib/bf_ruby2/models/notification.rb, line 344
def state=(state)
  validator = EnumAttributeValidator.new('String', ["Unsent", "Sending", "Sent"])
  unless validator.valid?(state)
    fail ArgumentError, "invalid value for 'state', must be one of #{validator.allowable_values}."
  end
  @state = state
end
to_body() click to toggle source

to_body is an alias to to_hash (backward compatibility) @return [Hash] Returns the object in the form of hash

# File lib/bf_ruby2/models/notification.rb, line 461
def to_body
  to_hash
end
to_hash() click to toggle source

Returns the object in the form of hash @return [Hash] Returns the object in the form of hash

# File lib/bf_ruby2/models/notification.rb, line 467
def to_hash
  hash = {}
  self.class.attribute_map.each_pair do |attr, param|
    value = self.send(attr)
    next if value.nil?
    hash[param] = _to_hash(value)
  end
  hash
end
to_s() click to toggle source

Returns the string representation of the object @return [String] String presentation of the object

# File lib/bf_ruby2/models/notification.rb, line 455
def to_s
  to_hash.to_s
end
valid?() click to toggle source

Check to see if the all the properties in the model are valid @return true if the model is valid

# File lib/bf_ruby2/models/notification.rb, line 291
def valid?
  return false if @domain.nil?
  domain_validator = EnumAttributeValidator.new('String', ["Notification", "Organization", "OrganizationGateway", "Product", "User", "Subscription", "Profile", "ProductRatePlan", "Client", "Invoice", "PricingComponentValue", "Account", "PricingComponentValueChange", "PricingComponentTier", "PricingComponent", "PricingCalculation", "Coupon", "CouponDiscount", "CouponDefinition", "CouponInstance", "CouponModifier", "CouponRule", "CouponBookDefinition", "CouponBook", "InvoiceLine", "Webhook", "WebhookSubscription", "SubscriptionCancellation", "NotificationSnapshot", "InvoicePayment", "Payment", "PaymentMethod", "PaymentMethodSubscriptionLink", "DunningLine", "CybersourceToken", "Card", "Alias", "PaypalSimplePaymentReconciliation", "FreePaymentReconciliation", "LocustworldPaymentReconciliation", "CouponInstanceExistingValue", "TaxLine", "TaxationStrategy", "TaxationLink", "Address", "AmendmentPriceNTime", "Authority", "UnitOfMeasure", "SearchResult", "Amendment", "AuditLog", "Password", "Username", "FixedTermDefinition", "FixedTerm", "Refund", "CreditNote", "Receipt", "AmendmentCompoundConstituent", "APIConfiguration", "StripeToken", "BraintreeToken", "BalancedToken", "AuthorizeNetToken", "PaypalToken", "SpreedlyToken", "SagePayToken", "TrustCommerceToken", "PayVisionToken", "SagePayOutstandingTransaction", "SagePayEnabledCardType", "SagePayTransaction", "GatewayRevenue", "Migration", "AdhocSubscription", "SubscriptionCharge", "ComponentChange", "Verification", "UsageRoundingStrategies", "PricingComponentValueMigrationChargeAmendmentMapping", "AmendmentDiscardAmendment", "EntityTime", "AggregatingComponent", "PricingComponentMigrationValue", "MetadataKeyValue", "Metadata", "AggregationLink", "BFPermission", "Role", "PermissionLink", "PayVisionTransaction", "KashToken", "DataSynchronizationJob", "DataSynchronizationJobError", "DataSynchronizationConfiguration", "DataSynchronizationAppConfiguration", "AggregationChildrenResponse", "InvoiceLinePayment", "EmailSubscription", "EmailProvider", "TimeResponse", "Email", "RevenueAttribution", "Unknown"])
  return false unless domain_validator.valid?(@domain)
  return false if @action.nil?
  action_validator = EnumAttributeValidator.new('String', ["Accept", "Active", "AwaitingPayment", "AwaitingRefund", "Cancelled", "Completed", "Created", "Error", "Expiring", "Expired", "Failed", "Migrated", "NeedsAmendments", "Paid", "Pending", "Provisioned", "Refunded", "Reject", "Trial", "Unknown", "Unpaid", "Updated", "Voided", "PaymentFailed"])
  return false unless action_validator.valid?(@action)
  return false if @organization_id.nil?
  return false if @webhook_id.nil?
  return false if @entity_id.nil?
  return false if @destination_url.nil?
  return false if @format.nil?
  format_validator = EnumAttributeValidator.new('String', ["JSON", "XML"])
  return false unless format_validator.valid?(@format)
  return false if @ack_enabled.nil?
  return false if @state.nil?
  state_validator = EnumAttributeValidator.new('String', ["Unsent", "Sending", "Sent"])
  return false unless state_validator.valid?(@state)
  return true
end