Class: NewStoreApi::Item1

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

Overview

Item1 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(access_token_ttl = SKIP, client_id = SKIP, created_at = SKIP, description = SKIP, id = SKIP, modiefied_at = SKIP, name = SKIP, scopes = SKIP) ⇒ Item1

Returns a new instance of Item1.



78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/new_store_api/models/item1.rb', line 78

def initialize(access_token_ttl = SKIP, client_id = SKIP, created_at = SKIP,
               description = SKIP, id = SKIP, modiefied_at = SKIP,
               name = SKIP, scopes = SKIP)
  @access_token_ttl = access_token_ttl unless access_token_ttl == SKIP
  @client_id = client_id unless client_id == SKIP
  @created_at = created_at unless created_at == SKIP
  @description = description unless description == SKIP
  @id = id unless id == SKIP
  @modiefied_at = modiefied_at unless modiefied_at == SKIP
  @name = name unless name == SKIP
  @scopes = scopes unless scopes == SKIP
end

Instance Attribute Details

#access_token_ttlInteger

access token validity in seconds

Returns:

  • (Integer)


15
16
17
# File 'lib/new_store_api/models/item1.rb', line 15

def access_token_ttl
  @access_token_ttl
end

#client_idString

access token validity in seconds

Returns:

  • (String)


19
20
21
# File 'lib/new_store_api/models/item1.rb', line 19

def client_id
  @client_id
end

#created_atDateTime

access token validity in seconds

Returns:

  • (DateTime)


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

def created_at
  @created_at
end

#descriptionString

access token validity in seconds

Returns:

  • (String)


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

def description
  @description
end

#idString

access token validity in seconds

Returns:

  • (String)


31
32
33
# File 'lib/new_store_api/models/item1.rb', line 31

def id
  @id
end

#modiefied_atDateTime

access token validity in seconds

Returns:

  • (DateTime)


35
36
37
# File 'lib/new_store_api/models/item1.rb', line 35

def modiefied_at
  @modiefied_at
end

#nameString

access token validity in seconds

Returns:

  • (String)


39
40
41
# File 'lib/new_store_api/models/item1.rb', line 39

def name
  @name
end

#scopesArray[String]

access token validity in seconds

Returns:

  • (Array[String])


43
44
45
# File 'lib/new_store_api/models/item1.rb', line 43

def scopes
  @scopes
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
# File 'lib/new_store_api/models/item1.rb', line 92

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  access_token_ttl =
    hash.key?('access_token_ttl') ? hash['access_token_ttl'] : SKIP
  client_id = hash.key?('client_id') ? hash['client_id'] : SKIP
  created_at = if hash.key?('created_at')
                 (DateTimeHelper.from_rfc3339(hash['created_at']) if hash['created_at'])
               else
                 SKIP
               end
  description = hash.key?('description') ? hash['description'] : SKIP
  id = hash.key?('id') ? hash['id'] : SKIP
  modiefied_at = if hash.key?('modiefied_at')
                   (DateTimeHelper.from_rfc3339(hash['modiefied_at']) if hash['modiefied_at'])
                 else
                   SKIP
                 end
  name = hash.key?('name') ? hash['name'] : SKIP
  scopes = hash.key?('scopes') ? hash['scopes'] : SKIP

  # Create object from extracted values.
  Item1.new(access_token_ttl,
            client_id,
            created_at,
            description,
            id,
            modiefied_at,
            name,
            scopes)
end

.namesObject

A mapping from model property names to API property names.



46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/new_store_api/models/item1.rb', line 46

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['access_token_ttl'] = 'access_token_ttl'
  @_hash['client_id'] = 'client_id'
  @_hash['created_at'] = 'created_at'
  @_hash['description'] = 'description'
  @_hash['id'] = 'id'
  @_hash['modiefied_at'] = 'modiefied_at'
  @_hash['name'] = 'name'
  @_hash['scopes'] = 'scopes'
  @_hash
end

.nullablesObject

An array for nullable fields



74
75
76
# File 'lib/new_store_api/models/item1.rb', line 74

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  %w[
    access_token_ttl
    client_id
    created_at
    description
    id
    modiefied_at
    name
    scopes
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



142
143
144
145
146
147
148
# File 'lib/new_store_api/models/item1.rb', line 142

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} access_token_ttl: #{@access_token_ttl.inspect}, client_id:"\
  " #{@client_id.inspect}, created_at: #{@created_at.inspect}, description:"\
  " #{@description.inspect}, id: #{@id.inspect}, modiefied_at: #{@modiefied_at.inspect}, name:"\
  " #{@name.inspect}, scopes: #{@scopes.inspect}>"
end

#to_custom_created_atObject



125
126
127
# File 'lib/new_store_api/models/item1.rb', line 125

def to_custom_created_at
  DateTimeHelper.to_rfc3339(created_at)
end

#to_custom_modiefied_atObject



129
130
131
# File 'lib/new_store_api/models/item1.rb', line 129

def to_custom_modiefied_at
  DateTimeHelper.to_rfc3339(modiefied_at)
end

#to_sObject

Provides a human-readable string representation of the object.



134
135
136
137
138
139
# File 'lib/new_store_api/models/item1.rb', line 134

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} access_token_ttl: #{@access_token_ttl}, client_id: #{@client_id},"\
  " created_at: #{@created_at}, description: #{@description}, id: #{@id}, modiefied_at:"\
  " #{@modiefied_at}, name: #{@name}, scopes: #{@scopes}>"
end