Class: Swagger::Shell::User

Inherits:
Object
  • Object
show all
Defined in:
lib/swagger/shell/user.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



4
5
6
# File 'lib/swagger/shell/user.rb', line 4

def id
  @id
end

#infoObject (readonly)

Returns the value of attribute info.



4
5
6
# File 'lib/swagger/shell/user.rb', line 4

def info
  @info
end

Instance Method Details

#clean!Object



21
22
23
24
# File 'lib/swagger/shell/user.rb', line 21

def clean!
  Dir.glob("#{users_path}/#{Swagger::Shell.env}.*.yml") {|f| File.delete f }
  @info = nil
end

#createObject



33
34
35
# File 'lib/swagger/shell/user.rb', line 33

def create
  # need to override
end

#debugObject

patch



42
43
44
45
46
47
# File 'lib/swagger/shell/user.rb', line 42

def debug
  command = "open #{Swagger::Shell.config_env.debug_url}/#{id}"
  puts command
  `#{command}`
  nil
end

#listObject



17
18
19
# File 'lib/swagger/shell/user.rb', line 17

def list
  Dir.glob("#{users_path}/#{Swagger::Shell.env}.*.yml").map {|f| File.basename(f, ".yml").gsub(/^#{Swagger::Shell.env}\./, "") }
end

#load(id) ⇒ Object



12
13
14
15
# File 'lib/swagger/shell/user.rb', line 12

def load(id)
  @id = id
  @info = YAML.load_file("#{users_path}/#{Swagger::Shell.env}.#{@id}.yml")
end

#load_sampleObject



6
7
8
9
10
# File 'lib/swagger/shell/user.rb', line 6

def load_sample
  id = list.sample
  return if id.nil?
  load(id)
end

#loginObject



37
38
39
# File 'lib/swagger/shell/user.rb', line 37

def 
  # need to override
end

#save(id, info) ⇒ Object



26
27
28
29
30
31
# File 'lib/swagger/shell/user.rb', line 26

def save(id, info)
  @id = id
  @info = info

  save_to_yml(@id, @info)
end