class Jahuty::Request::Factory

Instantiates a request from an action.

Public Instance Methods

call(action) click to toggle source
# File lib/jahuty/request/factory.rb, line 7
def call(action)
  Base.new(
    method: 'get',
    path: path(action),
    params: action.params
  )
end

Private Instance Methods

path(action) click to toggle source
# File lib/jahuty/request/factory.rb, line 17
def path(action)
  case action
  when ::Jahuty::Action::Show
    "snippets/#{action.id}/render"
  when ::Jahuty::Action::Index
    'snippets/render'
  else
    raise ArgumentError, 'Action is not supported'
  end
end