Class: NewStoreApi::NotificationRequest

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/new_store_api/models/notification_request.rb

Overview

NotificationRequest Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(data = SKIP, notification = SKIP, recipients = SKIP) ⇒ NotificationRequest

Returns a new instance of NotificationRequest.



49
50
51
52
53
# File 'lib/new_store_api/models/notification_request.rb', line 49

def initialize(data = SKIP, notification = SKIP, recipients = SKIP)
  @data = data unless data == SKIP
  @notification = notification unless notification == SKIP
  @recipients = recipients unless recipients == SKIP
end

Instance Attribute Details

#dataData

TODO: Write general description for this method

Returns:



14
15
16
# File 'lib/new_store_api/models/notification_request.rb', line 14

def data
  @data
end

#notificationNotification

TODO: Write general description for this method

Returns:



18
19
20
# File 'lib/new_store_api/models/notification_request.rb', line 18

def notification
  @notification
end

#recipientsRecipients

Recipients of the notification that might be a list of users or group by a custom topics. If more than one is set, the result is the intersection of them. They are technically filterd by the AND operator.

Returns:



24
25
26
# File 'lib/new_store_api/models/notification_request.rb', line 24

def recipients
  @recipients
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/new_store_api/models/notification_request.rb', line 56

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  data = Data.from_hash(hash['data']) if hash['data']
  notification = Notification.from_hash(hash['notification']) if hash['notification']
  recipients = Recipients.from_hash(hash['recipients']) if hash['recipients']

  # Create object from extracted values.
  NotificationRequest.new(data,
                          notification,
                          recipients)
end

.namesObject

A mapping from model property names to API property names.



27
28
29
30
31
32
33
# File 'lib/new_store_api/models/notification_request.rb', line 27

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['data'] = 'data'
  @_hash['notification'] = 'notification'
  @_hash['recipients'] = 'recipients'
  @_hash
end

.nullablesObject

An array for nullable fields



45
46
47
# File 'lib/new_store_api/models/notification_request.rb', line 45

def self.nullables
  []
end

.optionalsObject

An array for optional fields



36
37
38
39
40
41
42
# File 'lib/new_store_api/models/notification_request.rb', line 36

def self.optionals
  %w[
    data
    notification
    recipients
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



78
79
80
81
82
# File 'lib/new_store_api/models/notification_request.rb', line 78

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} data: #{@data.inspect}, notification: #{@notification.inspect}, recipients:"\
  " #{@recipients.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



71
72
73
74
75
# File 'lib/new_store_api/models/notification_request.rb', line 71

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} data: #{@data}, notification: #{@notification}, recipients:"\
  " #{@recipients}>"
end