Class: TryApi::Project
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Base
Class Method Details
.parse(hash) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'app/models/try_api/project.rb', line 10 def parse(hash) instance = self.new instance.name = hash[:project_name] instance.host = hash[:host] instance.port = hash[:port] instance.api_prefix = hash[:api_prefix] instance. = [] hash[:menu_items].each do |category| instance. << TryApi::MenuItem.parse(hash: category, project: instance) end instance end |
Instance Method Details
#endpoint ⇒ Object
28 29 30 |
# File 'app/models/try_api/project.rb', line 28 def endpoint "#{ host }#{ port.blank? ? '' : (':' + port.to_s) }" end |
#to_json ⇒ Object
24 25 26 |
# File 'app/models/try_api/project.rb', line 24 def to_json super.merge endpoint: endpoint end |