Class: NewStoreApi::Recipients
- Defined in:
- lib/new_store_api/models/recipients.rb
Overview
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.
Instance Attribute Summary collapse
-
#app_name ⇒ String
Recipients in a specific app.
-
#topics ⇒ Object
Recipients by subscriptions to a topics by name and value.
-
#user_ids ⇒ Array[String]
List of users who receive the notification.
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.
Instance Method Summary collapse
-
#initialize(app_name = nil, topics = SKIP, user_ids = SKIP) ⇒ Recipients
constructor
A new instance of Recipients.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(app_name = nil, topics = SKIP, user_ids = SKIP) ⇒ Recipients
Returns a new instance of Recipients.
48 49 50 51 52 |
# File 'lib/new_store_api/models/recipients.rb', line 48 def initialize(app_name = nil, topics = SKIP, user_ids = SKIP) @app_name = app_name @topics = topics unless topics == SKIP @user_ids = user_ids unless user_ids == SKIP end |
Instance Attribute Details
#app_name ⇒ String
Recipients in a specific app
16 17 18 |
# File 'lib/new_store_api/models/recipients.rb', line 16 def app_name @app_name end |
#topics ⇒ Object
Recipients by subscriptions to a topics by name and value
20 21 22 |
# File 'lib/new_store_api/models/recipients.rb', line 20 def topics @topics end |
#user_ids ⇒ Array[String]
List of users who receive the notification
24 25 26 |
# File 'lib/new_store_api/models/recipients.rb', line 24 def user_ids @user_ids end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/new_store_api/models/recipients.rb', line 55 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. app_name = hash.key?('app_name') ? hash['app_name'] : nil topics = hash.key?('topics') ? hash['topics'] : SKIP user_ids = hash.key?('user_ids') ? hash['user_ids'] : SKIP # Create object from extracted values. Recipients.new(app_name, topics, user_ids) end |
.names ⇒ Object
A mapping from model property names to API property names.
27 28 29 30 31 32 33 |
# File 'lib/new_store_api/models/recipients.rb', line 27 def self.names @_hash = {} if @_hash.nil? @_hash['app_name'] = 'app_name' @_hash['topics'] = 'topics' @_hash['user_ids'] = 'user_ids' @_hash end |
.nullables ⇒ Object
An array for nullable fields
44 45 46 |
# File 'lib/new_store_api/models/recipients.rb', line 44 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
36 37 38 39 40 41 |
# File 'lib/new_store_api/models/recipients.rb', line 36 def self.optionals %w[ topics user_ids ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
76 77 78 79 80 |
# File 'lib/new_store_api/models/recipients.rb', line 76 def inspect class_name = self.class.name.split('::').last "<#{class_name} app_name: #{@app_name.inspect}, topics: #{@topics.inspect}, user_ids:"\ " #{@user_ids.inspect}>" end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
70 71 72 73 |
# File 'lib/new_store_api/models/recipients.rb', line 70 def to_s class_name = self.class.name.split('::').last "<#{class_name} app_name: #{@app_name}, topics: #{@topics}, user_ids: #{@user_ids}>" end |