Class: Yandex360::Client
- Inherits:
-
Object
- Object
- Yandex360::Client
- Defined in:
- lib/yandex360/client.rb
Constant Summary collapse
- BASE_URL =
"https://api360.yandex.net/"
Instance Attribute Summary collapse
-
#adapter ⇒ Object
readonly
Returns the value of attribute adapter.
-
#token ⇒ Object
readonly
Returns the value of attribute token.
Instance Method Summary collapse
- #antispam ⇒ Object
- #audit ⇒ Object
- #connection ⇒ Object
- #departments ⇒ Object
- #dns ⇒ Object
- #domains ⇒ Object
- #groups ⇒ Object
-
#initialize(token:, adapter: Faraday.default_adapter, stubs: nil) ⇒ Client
constructor
A new instance of Client.
- #inspect ⇒ Object
- #organizations ⇒ Object
- #post_settings ⇒ Object
- #two_fa ⇒ Object
- #users ⇒ Object
Constructor Details
#initialize(token:, adapter: Faraday.default_adapter, stubs: nil) ⇒ Client
Returns a new instance of Client.
9 10 11 12 13 14 15 |
# File 'lib/yandex360/client.rb', line 9 def initialize(token:, adapter: Faraday.default_adapter, stubs: nil) raise ArgumentError, "Token cannot be nil or empty" if token.nil? || token.to_s.strip.empty? @token = token @adapter = adapter @stubs = stubs end |
Instance Attribute Details
#adapter ⇒ Object (readonly)
Returns the value of attribute adapter.
7 8 9 |
# File 'lib/yandex360/client.rb', line 7 def adapter @adapter end |
#token ⇒ Object (readonly)
Returns the value of attribute token.
7 8 9 |
# File 'lib/yandex360/client.rb', line 7 def token @token end |
Instance Method Details
#antispam ⇒ Object
17 18 19 |
# File 'lib/yandex360/client.rb', line 17 def antispam AntispamResource.new(self) end |
#audit ⇒ Object
49 50 51 |
# File 'lib/yandex360/client.rb', line 49 def audit AuditResource.new(self) end |
#connection ⇒ Object
57 58 59 |
# File 'lib/yandex360/client.rb', line 57 def connection @connection ||= build_connection end |
#departments ⇒ Object
21 22 23 |
# File 'lib/yandex360/client.rb', line 21 def departments DepartmentsResource.new(self) end |
#dns ⇒ Object
41 42 43 |
# File 'lib/yandex360/client.rb', line 41 def dns DnsResource.new(self) end |
#domains ⇒ Object
37 38 39 |
# File 'lib/yandex360/client.rb', line 37 def domains DomainsResource.new(self) end |
#groups ⇒ Object
25 26 27 |
# File 'lib/yandex360/client.rb', line 25 def groups GroupsResource.new(self) end |
#inspect ⇒ Object
61 62 63 |
# File 'lib/yandex360/client.rb', line 61 def inspect "#<#{self.class.name}:#{object_id} token=***>" end |
#organizations ⇒ Object
33 34 35 |
# File 'lib/yandex360/client.rb', line 33 def organizations OrganizationsResource.new(self) end |
#post_settings ⇒ Object
53 54 55 |
# File 'lib/yandex360/client.rb', line 53 def post_settings PostSettingsResource.new(self) end |
#two_fa ⇒ Object
45 46 47 |
# File 'lib/yandex360/client.rb', line 45 def two_fa TwoFaResource.new(self) end |
#users ⇒ Object
29 30 31 |
# File 'lib/yandex360/client.rb', line 29 def users UsersResource.new(self) end |