Class: Stastic::Command::Domains

Inherits:
Base
  • Object
show all
Defined in:
lib/stastic/commands/domains.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = []) ⇒ Domains

Returns a new instance of Domains.



5
6
7
8
9
10
11
12
13
14
# File 'lib/stastic/commands/domains.rb', line 5

def initialize(args = [])
  case args.size
  when 1
    self.domain_name = args.first
    raise(Stastic::Command::InvalidOptions) unless validate_domain(domain_name)
  else
    raise(Stastic::Command::InvalidOptions)
  end

end

Instance Attribute Details

#domain_nameObject

Returns the value of attribute domain_name.



3
4
5
# File 'lib/stastic/commands/domains.rb', line 3

def domain_name
  @domain_name
end

Instance Method Details

#addObject



19
20
21
22
23
24
25
# File 'lib/stastic/commands/domains.rb', line 19

def add
  print "Adding domain #{domain_name}... "
  with_valid_site do
    Stastic::Client.add_domain(Stastic::Config.site_id, domain_name)
  end
  puts "Success\n"
end

#indexObject



16
17
# File 'lib/stastic/commands/domains.rb', line 16

def index
end

#removeObject



27
28
29
30
31
32
33
# File 'lib/stastic/commands/domains.rb', line 27

def remove
  print "Removing domain #{domain_name}... "
  with_valid_site do
    Stastic::Client.remove_domain(Stastic::Config.site_id, domain_name)
  end
  puts "Success\n"
end