Class: Yandex360::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/yandex360/client.rb

Constant Summary collapse

BASE_URL =
"https://api360.yandex.net/"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(token:, adapter: Faraday.default_adapter, stubs: nil) ⇒ Client

Returns a new instance of Client.

Raises:

  • (ArgumentError)


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

#adapterObject (readonly)

Returns the value of attribute adapter.



7
8
9
# File 'lib/yandex360/client.rb', line 7

def adapter
  @adapter
end

#tokenObject (readonly)

Returns the value of attribute token.



7
8
9
# File 'lib/yandex360/client.rb', line 7

def token
  @token
end

Instance Method Details

#antispamObject



17
18
19
# File 'lib/yandex360/client.rb', line 17

def antispam
  AntispamResource.new(self)
end

#auditObject



49
50
51
# File 'lib/yandex360/client.rb', line 49

def audit
  AuditResource.new(self)
end

#connectionObject



57
58
59
# File 'lib/yandex360/client.rb', line 57

def connection
  @connection ||= build_connection
end

#departmentsObject



21
22
23
# File 'lib/yandex360/client.rb', line 21

def departments
  DepartmentsResource.new(self)
end

#dnsObject



41
42
43
# File 'lib/yandex360/client.rb', line 41

def dns
  DnsResource.new(self)
end

#domainsObject



37
38
39
# File 'lib/yandex360/client.rb', line 37

def domains
  DomainsResource.new(self)
end

#groupsObject



25
26
27
# File 'lib/yandex360/client.rb', line 25

def groups
  GroupsResource.new(self)
end

#inspectObject



61
62
63
# File 'lib/yandex360/client.rb', line 61

def inspect
  "#<#{self.class.name}:#{object_id} token=***>"
end

#organizationsObject



33
34
35
# File 'lib/yandex360/client.rb', line 33

def organizations
  OrganizationsResource.new(self)
end

#post_settingsObject



53
54
55
# File 'lib/yandex360/client.rb', line 53

def post_settings
  PostSettingsResource.new(self)
end

#two_faObject



45
46
47
# File 'lib/yandex360/client.rb', line 45

def two_fa
  TwoFaResource.new(self)
end

#usersObject



29
30
31
# File 'lib/yandex360/client.rb', line 29

def users
  UsersResource.new(self)
end