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
|
# File 'app/models/try_api/method.rb', line 13
def parse(hash:, project:)
return nil if hash.blank?
instance = self.new
instance.project = project
instance.title = hash[:title]
instance.html = hash[:html]
instance.parameters = hash[:parameters]
instance. = hash[:headers]
instance.method = hash[:method].try(:upcase)
instance.path = hash[:path]
instance.example_responses = []
if hash[:example_responses].is_a? Array
hash[:example_responses].each do |example|
instance.example_responses << TryApi::ExampleResponse.parse(example)
end
else
end
instance.parameters = []
if hash[:parameters].is_a? Array
hash[:parameters].each do |parameter|
instance.parameters << TryApi::Parameter.parse(parameter)
end
else
end
instance. = []
if hash[:headers].is_a? Array
hash[:headers].each do ||
instance. << TryApi::.parse()
end
else
end
instance
end
|