Class: FastshopCatalog::ServiceUrls

Inherits:
Object
  • Object
show all
Defined in:
lib/fastshop_catalog/service_urls.rb

Constant Summary collapse

DEFAULT_BASE_URL =
'http://www.fastincentivos.com.br'
PRODUCTION_URLS =
{
  catalogo: "http://www.fastincentivos.com.br:8081/Catalogo.svc/service",
  consulta_disponibilidade: "http://www.fastincentivos.com.br:8084/ConsultaDisponibilidade.svc/service",
  consulta_dne_externo: "http://www.fastincentivos.com.br:8086/ConsultaDneExterno.svc/service",
  colocacao_pedido: "http://www.fastincentivos.com.br:8082/ColocacaoPedido.svc/service",
  consulta_status: "http://www.fastincentivos.com.br:8090/ConsultaStatusPedido.svc/service",
  participante: "http://www.fastincentivos.com.br:8093/Participante.svc/service",
  consulta_produto: "#{DEFAULT_BASE_URL}/FastServices.WsConsultaProduto/ConsultaProduto.svc/service"
}
HOMOLOG_URLS =
{
  catalogo: "#{DEFAULT_BASE_URL}/FastServices.WsCatalogo/Catalogo.svc/service",
  consulta_disponibilidade: "#{DEFAULT_BASE_URL}/FastServices.WsConsultaDisponibilidade/ConsultaDisponibilidade.svc/service",
  consulta_dne_externo: "#{DEFAULT_BASE_URL}/FastServices.WsConsultaDneExterno/ConsultaDneExterno.svc/service",
  colocacao_pedido: "#{DEFAULT_BASE_URL}/FastServices.WsColocacaoPedido/ColocacaoPedido.svc/service",
  consulta_status: "#{DEFAULT_BASE_URL}/FastServices.WsConsultaStatusPedido/ConsultaStatusPedido.svc/service",
  participante: "#{DEFAULT_BASE_URL}/FastServices.WsParticipante/Participante.svc/service",
  consulta_produto: "#{DEFAULT_BASE_URL}/FastServices.WsConsultaProduto/ConsultaProduto.svc/service"
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(env) ⇒ ServiceUrls

Returns a new instance of ServiceUrls.



26
27
28
# File 'lib/fastshop_catalog/service_urls.rb', line 26

def initialize(env)
  @env = env
end

Instance Attribute Details

#envObject (readonly)

Returns the value of attribute env.



24
25
26
# File 'lib/fastshop_catalog/service_urls.rb', line 24

def env
  @env
end

Instance Method Details

#url_for(serv) ⇒ Object



30
31
32
33
34
35
36
37
38
39
# File 'lib/fastshop_catalog/service_urls.rb', line 30

def url_for(serv)
  url = ""
  if env == "production"
    url = PRODUCTION_URLS.fetch(serv)
  else
    url = HOMOLOG_URLS.fetch(serv)
  end

  url
end