Class: LobbyingDisclosureClient::Enums::Route

Inherits:
T::Enum
  • Object
show all
Extended by:
T::Sig
Defined in:
lib/lobbying_disclosure_client/enums/route.rb

Instance Method Summary collapse

Instance Method Details

#to_full_api_path(path_params: []) ⇒ Object



55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/lobbying_disclosure_client/enums/route.rb', line 55

def to_full_api_path(path_params: [])
  path = case self
         when V1
           '/v1/'
         when V1_Constants_Contribution_ItemTypes
           '/v1/constants/contribution/itemtypes/'
         when V1_Constants_Filing_ListFilingTypes
           '/v1/constants/filing/filingtypes/'
         when V1_Constants_Filing_LobbyingActivityIssues
           '/v1/constants/filing/lobbyingactivityissues/'
         when V1_Constants_Filing_GovernmentEntities
           '/v1/constants/filing/governmententities/'
         when V1_Constants_General_Countries
           '/v1/constants/general/countries/'
         when V1_Constants_General_States
           '/v1/constants/general/states/'
         when V1_Constants_Lobbyist_Prefixes
           '/v1/constants/lobbyist/prefixes/'
         when V1_Constants_Lobbyist_Suffixes
           '/v1/constants/lobbyist/suffixes/'
         when V1_Contributions_ListContributionReports, V1_Contributions_RetrieveContributionReport
           '/v1/contributions/'
         when V1_Filings_ListFilings, V1_Filings_RetrieveFiling
           '/v1/filings/'
         when V1_Registrants_ListRegistrants, V1_Registrants_RetrieveRegistrant
           '/v1/registrants/'
         when V1_Clients_ListClients, V1_Clients_RetrieveClient
           '/v1/clients/'
         when V1_Lobbyists_ListLobbyists, V1_Lobbyists_RetrieveLobbyist
           '/v1/lobbyists/'
         when Auth_Login
           '/auth/login/'
         when Auth_Password_Reset
           '/auth/password/reset/'
         when Auth_Password_Reset_Confirm
           '/auth/password/reset/confirm/'
         else
           T.absurd(self)
         end

  if path_params.empty?
    [BASE_URL, path].join
  else
    "#{[BASE_URL, path].join}#{path_params.join('/')}/"
  end
end