Module: Model::Menu::ViewMenu

Extended by:
ActiveSupport::Concern
Included in:
Wechat::ViewMenu
Defined in:
app/models/wechat/model/menu/view_menu.rb

Instance Method Summary collapse

Instance Method Details

#as_jsonObject



11
12
13
14
15
16
17
# File 'app/models/wechat/model/menu/view_menu.rb', line 11

def as_json
  {
    type: 'view',
    name: name,
    url: url
  }
end

#hostObject



26
27
28
29
30
31
32
33
# File 'app/models/wechat/model/menu/view_menu.rb', line 26

def host
  organ = app&.organ
  if organ
    organ.host
  else
    ''
  end
end

#urlObject



19
20
21
22
23
24
# File 'app/models/wechat/model/menu/view_menu.rb', line 19

def url
  ActionDispatch::Http::URL.url_for(
    host: value,
    protocol: Rails.application.routes.default_url_options[:protocol]
  )
end