Class: CirroIOV2::Client
- Inherits:
-
Object
- Object
- CirroIOV2::Client
- Defined in:
- lib/cirro_io_v2/client.rb
Constant Summary collapse
- DEFAULT_OPTIONS =
{ site: 'https://cirro.io/api', api_version: 'v2', auth_type: :jwt, }.freeze
- DEFINED_OPTIONS =
(DEFAULT_OPTIONS.keys + [:private_key, :private_key_path, :client_id]).freeze
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#request_client ⇒ Object
Returns the value of attribute request_client.
Instance Method Summary collapse
- #EpamHeroesBadges ⇒ Object
- #Gig ⇒ Object
- #GigInvitation ⇒ Object
- #GigResult ⇒ Object
- #GigTimeActivity ⇒ Object
-
#initialize(options = {}) ⇒ Client
constructor
A new instance of Client.
- #NotificationBroadcast ⇒ Object
- #NotificationConfiguration ⇒ Object
- #NotificationLayout ⇒ Object
- #NotificationLayoutTemplate ⇒ Object
- #NotificationLocale ⇒ Object
- #NotificationTemplate ⇒ Object
- #NotificationTopic ⇒ Object
- #NotificationTopicPreference ⇒ Object
- #Payout ⇒ Object
- #SpaceInvitation ⇒ Object
-
#User ⇒ Object
resources rubocop:disable Naming/MethodName.
Constructor Details
#initialize(options = {}) ⇒ Client
Returns a new instance of Client.
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/cirro_io_v2/client.rb', line 44 def initialize( = {}) @options = DEFAULT_OPTIONS.merge() = @options.keys.reject { |o| DEFINED_OPTIONS.include?(o) } raise ArgumentError, "Unknown option(s) given: #{}" unless .empty? # TODO: for now we only have jwt case @options[:auth_type] when :jwt private_key = OpenSSL::PKey::RSA.new(@options[:private_key]) if @options[:private_key] private_key = OpenSSL::PKey::RSA.new(File.read(@options[:private_key_path])) if @options[:private_key_path] @request_client = RequestClients::Jwt.new(base_url: "#{@options[:site]}/#{@options[:api_version]}", client_id: @options[:client_id], private_key:) else raise ArgumentError, 'Options: ":auth_type" must be ":jwt"' end end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
34 35 36 |
# File 'lib/cirro_io_v2/client.rb', line 34 def @options end |
#request_client ⇒ Object
Returns the value of attribute request_client.
33 34 35 |
# File 'lib/cirro_io_v2/client.rb', line 33 def request_client @request_client end |
Instance Method Details
#EpamHeroesBadges ⇒ Object
126 127 128 |
# File 'lib/cirro_io_v2/client.rb', line 126 def EpamHeroesBadges Resources::EpamHeroes::Badges.new(self) end |
#Gig ⇒ Object
78 79 80 |
# File 'lib/cirro_io_v2/client.rb', line 78 def Gig Resources::Gig.new(self) end |
#GigInvitation ⇒ Object
74 75 76 |
# File 'lib/cirro_io_v2/client.rb', line 74 def GigInvitation Resources::GigInvitation.new(self) end |
#GigResult ⇒ Object
82 83 84 |
# File 'lib/cirro_io_v2/client.rb', line 82 def GigResult Resources::GigResult.new(self) end |
#GigTimeActivity ⇒ Object
86 87 88 |
# File 'lib/cirro_io_v2/client.rb', line 86 def GigTimeActivity Resources::GigTimeActivity.new(self) end |
#NotificationBroadcast ⇒ Object
94 95 96 |
# File 'lib/cirro_io_v2/client.rb', line 94 def NotificationBroadcast Resources::NotificationBroadcast.new(self) end |
#NotificationConfiguration ⇒ Object
106 107 108 |
# File 'lib/cirro_io_v2/client.rb', line 106 def NotificationConfiguration Resources::NotificationConfiguration.new(self) end |
#NotificationLayout ⇒ Object
114 115 116 |
# File 'lib/cirro_io_v2/client.rb', line 114 def NotificationLayout Resources::NotificationLayout.new(self) end |
#NotificationLayoutTemplate ⇒ Object
110 111 112 |
# File 'lib/cirro_io_v2/client.rb', line 110 def NotificationLayoutTemplate Resources::NotificationLayoutTemplate.new(self) end |
#NotificationLocale ⇒ Object
118 119 120 |
# File 'lib/cirro_io_v2/client.rb', line 118 def NotificationLocale Resources::NotificationLocale.new(self) end |
#NotificationTemplate ⇒ Object
122 123 124 |
# File 'lib/cirro_io_v2/client.rb', line 122 def NotificationTemplate Resources::NotificationTemplate.new(self) end |
#NotificationTopic ⇒ Object
102 103 104 |
# File 'lib/cirro_io_v2/client.rb', line 102 def NotificationTopic Resources::NotificationTopic.new(self) end |
#NotificationTopicPreference ⇒ Object
98 99 100 |
# File 'lib/cirro_io_v2/client.rb', line 98 def NotificationTopicPreference Resources::NotificationTopicPreference.new(self) end |
#Payout ⇒ Object
90 91 92 |
# File 'lib/cirro_io_v2/client.rb', line 90 def Payout Resources::Payout.new(self) end |
#SpaceInvitation ⇒ Object
70 71 72 |
# File 'lib/cirro_io_v2/client.rb', line 70 def SpaceInvitation Resources::SpaceInvitation.new(self) end |