Class: HaveAPI::GoClient::ApiVersion
- Inherits:
-
Object
- Object
- HaveAPI::GoClient::ApiVersion
- Defined in:
- lib/haveapi/go_client/api_version.rb
Constant Summary collapse
- CLIENT_MEMBERS =
%w[ AllowOAuth2Origin Authentication DoBodyRequest DoQueryStringRequest GetLanguage GetLanguageHeader SetHTTPClient SetLanguage SetLanguageHeader SetTimeout Url ].freeze
- AUTHENTICATION_CLIENT_MEMBERS =
{ basic: %w[ SetBasicAuthentication ], oauth2: %w[ RevokeAccessToken SetExistingOAuth2Auth ], token: %w[ RevokeAuthToken SetExistingTokenAuth SetNewTokenAuth SetTokenAuthMode ] }.freeze
Instance Attribute Summary collapse
- #auth_methods ⇒ Array<Authentication::Base> readonly
- #metadata_namespace ⇒ String readonly
- #resources ⇒ Array<Resource> readonly
Instance Method Summary collapse
-
#initialize(desc) ⇒ ApiVersion
constructor
A new instance of ApiVersion.
Constructor Details
#initialize(desc) ⇒ ApiVersion
Returns a new instance of ApiVersion.
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/haveapi/go_client/api_version.rb', line 44 def initialize(desc) @resources = desc[:resources].map do |k, v| Resource.new(self, k, v) end.sort! client_members = CLIENT_MEMBERS + desc[:authentication].keys.flat_map do |name| AUTHENTICATION_CLIENT_MEMBERS.fetch(name.to_sym, []) end Resource.allocate_member_names(@resources, [], reserved: client_members) @resources.each(&:resolve_associations) @auth_methods = desc[:authentication].map do |k, v| AuthenticationMethods.new(self, k, v) end @metadata_namespace = desc[:meta][:namespace] end |
Instance Attribute Details
#auth_methods ⇒ Array<Authentication::Base> (readonly)
36 37 38 |
# File 'lib/haveapi/go_client/api_version.rb', line 36 def auth_methods @auth_methods end |
#metadata_namespace ⇒ String (readonly)
39 40 41 |
# File 'lib/haveapi/go_client/api_version.rb', line 39 def @metadata_namespace end |
#resources ⇒ Array<Resource> (readonly)
42 43 44 |
# File 'lib/haveapi/go_client/api_version.rb', line 42 def resources @resources end |