Class: EyServicesFake::UrlGenerator

Inherits:
Object
  • Object
show all
Defined in:
lib/ey_services_fake/url_generator.rb

Instance Method Summary collapse

Constructor Details

#initialize(base_url) ⇒ UrlGenerator

Returns a new instance of UrlGenerator.



4
5
6
# File 'lib/ey_services_fake/url_generator.rb', line 4

def initialize(base_url)
  @base_url = base_url
end

Instance Method Details

#invoice(service, service_account, invoice) ⇒ Object



32
33
34
# File 'lib/ey_services_fake/url_generator.rb', line 32

def invoice(service, , invoice)
  "#{@base_url}/api/1/partners/#{service.partner_id}/services/#{service.id}/service_accounts/#{service_account.id}/invoices/#{invoice.id}"
end

#invoices(service, service_account) ⇒ Object



28
29
30
# File 'lib/ey_services_fake/url_generator.rb', line 28

def invoices(service, )
  "#{@base_url}/api/1/partners/#{service.partner_id}/services/#{service.id}/service_accounts/#{service_account.id}/invoices"
end

#messages(service, service_account, provisioned_service = nil) ⇒ Object



20
21
22
23
24
25
26
# File 'lib/ey_services_fake/url_generator.rb', line 20

def messages(service, , provisioned_service = nil)
  if provisioned_service
    "#{@base_url}/api/1/partners/#{service.partner_id}/services/#{service.id}/service_accounts/#{service_account.id}/provisioned_service/#{provisioned_service.id}/messages"
  else
    "#{@base_url}/api/1/partners/#{service.partner_id}/services/#{service.id}/service_accounts/#{service_account.id}/messages"
  end
end

#partner_provisioned_service(service_account, provisioned_service) ⇒ Object



36
37
38
# File 'lib/ey_services_fake/url_generator.rb', line 36

def partner_provisioned_service(, provisioned_service)
  "#{@base_url}/api/1/service_accounts/#{service_account.id}/provisioned_service/#{provisioned_service.id}"
end

#partner_service_account(service, service_account) ⇒ Object



16
17
18
# File 'lib/ey_services_fake/url_generator.rb', line 16

def (service, )
  "#{@base_url}/api/1/partners/#{service.partner_id}/services/#{service.id}/service_accounts/#{service_account.id}"
end

#service(service) ⇒ Object



12
13
14
# File 'lib/ey_services_fake/url_generator.rb', line 12

def service(service)
  "#{@base_url}/api/1/partners/#{service.partner_id}/services/#{service.id}"
end

#service_registration(partner) ⇒ Object



8
9
10
# File 'lib/ey_services_fake/url_generator.rb', line 8

def service_registration(partner)
  "#{@base_url}/api/1/partners/#{partner.id}/services"
end