forked from swagger-api/swagger-codegen
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Pet.rb
71 lines (64 loc) · 1.97 KB
/
Pet.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
class Pet
# alan comment
attr_accessor :id, :tags, :category, :status, :name, :photo_urls
# :internal => :external
def self.attribute_map
{
:id => :id, :tags => :tags, :category => :category, :status => :status, :name => :name, :photo_urls => :photoUrls
}
end
def initialize(attributes = {})
# Morph attribute keys into undescored rubyish style
if attributes.to_s != ""
if Pet.attribute_map["id".to_sym] != nil
name = "id".to_sym
value = attributes["id"]
send("#{name}=", value) if self.respond_to?(name)
end
if Pet.attribute_map["tags".to_sym] != nil
name = "tags".to_sym
value = attributes["tags"]
if value.is_a?(Array)
array = Array.new
value.each do |arrayValue|
array.push Tag.new(arrayValue)
end
send("#{name}=", array) if self.respond_to?(name)
end
end
if Pet.attribute_map["category".to_sym] != nil
name = "category".to_sym
value = attributes["category"]
send("#{name}=", value) if self.respond_to?(name)
end
if Pet.attribute_map["status".to_sym] != nil
name = "status".to_sym
value = attributes["status"]
send("#{name}=", value) if self.respond_to?(name)
end
if Pet.attribute_map["name".to_sym] != nil
name = "name".to_sym
value = attributes["name"]
send("#{name}=", value) if self.respond_to?(name)
end
if Pet.attribute_map["photo_urls".to_sym] != nil
name = "photo_urls".to_sym
value = attributes["photoUrls"]
if value.is_a?(Array)
array = Array.new
value.each do |arrayValue|
array.push arrayValue
end
send("#{name}=", array) if self.respond_to?(name)
end
end
end
end
def to_body
body = {}
Pet.attribute_map.each_pair do |key,value|
body[value] = self.send(key) unless self.send(key).nil?
end
body
end
end