Class: WalmartApIs::Channel

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/walmart_ap_is/models/channel.rb

Overview

Channel 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(channel_owner:, channel_name:, type:, webhook_config: SKIP, status: SKIP, channel_id: SKIP, created_timestamp: SKIP, last_modified_timestamp: SKIP, additional_properties: nil) ⇒ Channel

Returns a new instance of Channel.



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/walmart_ap_is/models/channel.rb', line 74

def initialize(channel_owner:, channel_name:, type:, webhook_config: SKIP,
               status: SKIP, channel_id: SKIP, created_timestamp: SKIP,
               last_modified_timestamp: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @channel_owner = channel_owner
  @channel_name = channel_name
  @type = type
  @webhook_config = webhook_config unless webhook_config == SKIP
  @status = status unless status == SKIP
  @channel_id = channel_id unless channel_id == SKIP
  @created_timestamp = created_timestamp unless created_timestamp == SKIP
  @last_modified_timestamp = last_modified_timestamp unless last_modified_timestamp == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#channel_idString

TODO: Write general description for this method

Returns:

  • (String)


34
35
36
# File 'lib/walmart_ap_is/models/channel.rb', line 34

def channel_id
  @channel_id
end

#channel_nameString

TODO: Write general description for this method

Returns:

  • (String)


18
19
20
# File 'lib/walmart_ap_is/models/channel.rb', line 18

def channel_name
  @channel_name
end

#channel_ownerString

TODO: Write general description for this method

Returns:

  • (String)


14
15
16
# File 'lib/walmart_ap_is/models/channel.rb', line 14

def channel_owner
  @channel_owner
end

#created_timestampInteger

TODO: Write general description for this method

Returns:

  • (Integer)


38
39
40
# File 'lib/walmart_ap_is/models/channel.rb', line 38

def created_timestamp
  @created_timestamp
end

#last_modified_timestampInteger

TODO: Write general description for this method

Returns:

  • (Integer)


42
43
44
# File 'lib/walmart_ap_is/models/channel.rb', line 42

def last_modified_timestamp
  @last_modified_timestamp
end

#statusString

TODO: Write general description for this method

Returns:

  • (String)


30
31
32
# File 'lib/walmart_ap_is/models/channel.rb', line 30

def status
  @status
end

#typeString

TODO: Write general description for this method

Returns:

  • (String)


22
23
24
# File 'lib/walmart_ap_is/models/channel.rb', line 22

def type
  @type
end

#webhook_configObject

TODO: Write general description for this method

Returns:

  • (Object)


26
27
28
# File 'lib/walmart_ap_is/models/channel.rb', line 26

def webhook_config
  @webhook_config
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
124
# File 'lib/walmart_ap_is/models/channel.rb', line 92

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  channel_owner = hash.key?('channelOwner') ? hash['channelOwner'] : nil
  channel_name = hash.key?('channelName') ? hash['channelName'] : nil
  type = hash.key?('type') ? hash['type'] : nil
  webhook_config = hash.key?('webhookConfig') ? hash['webhookConfig'] : SKIP
  status = hash.key?('status') ? hash['status'] : SKIP
  channel_id = hash.key?('channelId') ? hash['channelId'] : SKIP
  created_timestamp =
    hash.key?('createdTimestamp') ? hash['createdTimestamp'] : SKIP
  last_modified_timestamp =
    hash.key?('lastModifiedTimestamp') ? hash['lastModifiedTimestamp'] : SKIP

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  Channel.new(channel_owner: channel_owner,
              channel_name: channel_name,
              type: type,
              webhook_config: webhook_config,
              status: status,
              channel_id: channel_id,
              created_timestamp: created_timestamp,
              last_modified_timestamp: last_modified_timestamp,
              additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/walmart_ap_is/models/channel.rb', line 45

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['channel_owner'] = 'channelOwner'
  @_hash['channel_name'] = 'channelName'
  @_hash['type'] = 'type'
  @_hash['webhook_config'] = 'webhookConfig'
  @_hash['status'] = 'status'
  @_hash['channel_id'] = 'channelId'
  @_hash['created_timestamp'] = 'createdTimestamp'
  @_hash['last_modified_timestamp'] = 'lastModifiedTimestamp'
  @_hash
end

.nullablesObject

An array for nullable fields



70
71
72
# File 'lib/walmart_ap_is/models/channel.rb', line 70

def self.nullables
  []
end

.optionalsObject

An array for optional fields



59
60
61
62
63
64
65
66
67
# File 'lib/walmart_ap_is/models/channel.rb', line 59

def self.optionals
  %w[
    webhook_config
    status
    channel_id
    created_timestamp
    last_modified_timestamp
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



136
137
138
139
140
141
142
143
144
# File 'lib/walmart_ap_is/models/channel.rb', line 136

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} channel_owner: #{@channel_owner.inspect}, channel_name:"\
  " #{@channel_name.inspect}, type: #{@type.inspect}, webhook_config:"\
  " #{@webhook_config.inspect}, status: #{@status.inspect}, channel_id:"\
  " #{@channel_id.inspect}, created_timestamp: #{@created_timestamp.inspect},"\
  " last_modified_timestamp: #{@last_modified_timestamp.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



127
128
129
130
131
132
133
# File 'lib/walmart_ap_is/models/channel.rb', line 127

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} channel_owner: #{@channel_owner}, channel_name: #{@channel_name}, type:"\
  " #{@type}, webhook_config: #{@webhook_config}, status: #{@status}, channel_id:"\
  " #{@channel_id}, created_timestamp: #{@created_timestamp}, last_modified_timestamp:"\
  " #{@last_modified_timestamp}, additional_properties: #{@additional_properties}>"
end