Class: NewStoreApi::SubscriptionRequest

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

Overview

SubscriptionRequest 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(app_name = nil, topic_name = nil, topic_value = nil, user_id = nil) ⇒ SubscriptionRequest

Returns a new instance of SubscriptionRequest.



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

def initialize(app_name = nil, topic_name = nil, topic_value = nil,
               user_id = nil)
  @app_name = app_name
  @topic_name = topic_name
  @topic_value = topic_value
  @user_id = user_id
end

Instance Attribute Details

#app_nameString

Identifier of the app name where this topic makes sense.

Returns:

  • (String)


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

def app_name
  @app_name
end

#topic_nameString

Identifier topic name for this subscription

Returns:

  • (String)


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

def topic_name
  @topic_name
end

#topic_valueString

Identifier topic value for this subscription which can be 'True' or 'False'

Returns:

  • (String)


23
24
25
# File 'lib/new_store_api/models/subscription_request.rb', line 23

def topic_value
  @topic_value
end

#user_idString

Identifier of the user who wants to subscribe to a new topic.

Returns:

  • (String)


27
28
29
# File 'lib/new_store_api/models/subscription_request.rb', line 27

def user_id
  @user_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# File 'lib/new_store_api/models/subscription_request.rb', line 58

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  app_name = hash.key?('app_name') ? hash['app_name'] : nil
  topic_name = hash.key?('topic_name') ? hash['topic_name'] : nil
  topic_value = hash.key?('topic_value') ? hash['topic_value'] : nil
  user_id = hash.key?('user_id') ? hash['user_id'] : nil

  # Create object from extracted values.
  SubscriptionRequest.new(app_name,
                          topic_name,
                          topic_value,
                          user_id)
end

.namesObject

A mapping from model property names to API property names.



30
31
32
33
34
35
36
37
# File 'lib/new_store_api/models/subscription_request.rb', line 30

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['app_name'] = 'app_name'
  @_hash['topic_name'] = 'topic_name'
  @_hash['topic_value'] = 'topic_value'
  @_hash['user_id'] = 'user_id'
  @_hash
end

.nullablesObject

An array for nullable fields



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

def self.nullables
  []
end

.optionalsObject

An array for optional fields



40
41
42
# File 'lib/new_store_api/models/subscription_request.rb', line 40

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



82
83
84
85
86
# File 'lib/new_store_api/models/subscription_request.rb', line 82

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} app_name: #{@app_name.inspect}, topic_name: #{@topic_name.inspect},"\
  " topic_value: #{@topic_value.inspect}, user_id: #{@user_id.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



75
76
77
78
79
# File 'lib/new_store_api/models/subscription_request.rb', line 75

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} app_name: #{@app_name}, topic_name: #{@topic_name}, topic_value:"\
  " #{@topic_value}, user_id: #{@user_id}>"
end