Class: NewStoreApi::RegistrationResponse

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

Overview

RegistrationResponse 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(device_id = nil, app_name = SKIP, app_os = SKIP, store_id = SKIP, user_id = SKIP) ⇒ RegistrationResponse

Returns a new instance of RegistrationResponse.



58
59
60
61
62
63
64
65
# File 'lib/new_store_api/models/registration_response.rb', line 58

def initialize(device_id = nil, app_name = SKIP, app_os = SKIP,
               store_id = SKIP, user_id = SKIP)
  @app_name = app_name unless app_name == SKIP
  @app_os = app_os unless app_os == SKIP
  @device_id = device_id
  @store_id = store_id unless store_id == SKIP
  @user_id = user_id unless user_id == SKIP
end

Instance Attribute Details

#app_nameString

Identifier of the app name who recently used the device

Returns:

  • (String)


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

def app_name
  @app_name
end

#app_osString

Identifier of the app OS who recently used the device

Returns:

  • (String)


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

def app_os
  @app_os
end

#device_idString

Registration or device id.

Returns:

  • (String)


22
23
24
# File 'lib/new_store_api/models/registration_response.rb', line 22

def device_id
  @device_id
end

#store_idString

Identifier of the store id who recently used the device

Returns:

  • (String)


26
27
28
# File 'lib/new_store_api/models/registration_response.rb', line 26

def store_id
  @store_id
end

#user_idString

Identifier of the user who recently used the device.

Returns:

  • (String)


30
31
32
# File 'lib/new_store_api/models/registration_response.rb', line 30

def user_id
  @user_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# File 'lib/new_store_api/models/registration_response.rb', line 68

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  device_id = hash.key?('device_id') ? hash['device_id'] : nil
  app_name = hash.key?('app_name') ? hash['app_name'] : SKIP
  app_os = hash.key?('app_os') ? hash['app_os'] : SKIP
  store_id = hash.key?('store_id') ? hash['store_id'] : SKIP
  user_id = hash.key?('user_id') ? hash['user_id'] : SKIP

  # Create object from extracted values.
  RegistrationResponse.new(device_id,
                           app_name,
                           app_os,
                           store_id,
                           user_id)
end

.namesObject

A mapping from model property names to API property names.



33
34
35
36
37
38
39
40
41
# File 'lib/new_store_api/models/registration_response.rb', line 33

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['app_name'] = 'app_name'
  @_hash['app_os'] = 'app_os'
  @_hash['device_id'] = 'device_id'
  @_hash['store_id'] = 'store_id'
  @_hash['user_id'] = 'user_id'
  @_hash
end

.nullablesObject

An array for nullable fields



54
55
56
# File 'lib/new_store_api/models/registration_response.rb', line 54

def self.nullables
  []
end

.optionalsObject

An array for optional fields



44
45
46
47
48
49
50
51
# File 'lib/new_store_api/models/registration_response.rb', line 44

def self.optionals
  %w[
    app_name
    app_os
    store_id
    user_id
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



94
95
96
97
98
# File 'lib/new_store_api/models/registration_response.rb', line 94

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

#to_sObject

Provides a human-readable string representation of the object.



87
88
89
90
91
# File 'lib/new_store_api/models/registration_response.rb', line 87

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