Module: Ugigi

Defined in:
lib/ugigi.rb,
lib/ugigi/scheme.rb,
lib/ugigi/version.rb

Defined Under Namespace

Classes: Index, Scheme

Constant Summary collapse

BASE_URL =
"http://ugigi.dvrdns.org/api/"
VERSION =
"0.4.2"

Class Method Summary collapse

Class Method Details

.mylist(args = {}) ⇒ Object



66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'lib/ugigi.rb', line 66

def self.mylist(args={})
  case args[:only]
  when :sosowa
    args = args.update(:sswp => 0, :compe => 0)
  when :compe
    args = args.update(:sswl => 0, :sswp => 0)
  when :sswp
    args = args.update(:sswl => 0, :compe => 0)
  end
  args.delete(:only) if args.has_key? :only
  data = send_req("list/get", args)
  indexes = []
  data.each do |e|
    index = Index.new(e)
    case args[:style]
    when :sosowa
      index.element = index.to_sosowa_index
      indexes << index
    else
      indexes << index
    end
  end
  return indexes
end

.mylist_add(args = {}) ⇒ Object



91
92
93
94
# File 'lib/ugigi.rb', line 91

def self.mylist_add(args={})
  data = send_req("list/add", args)
  return data
end

.mylist_edit(args = {}) ⇒ Object



101
102
103
104
# File 'lib/ugigi.rb', line 101

def self.mylist_edit(args={})
  data = send_req("list/edit", args)
  return data
end

.mylist_remove(args = {}) ⇒ Object



96
97
98
99
# File 'lib/ugigi.rb', line 96

def self.mylist_remove(args={})
  data = send_req("list/rem", args)
  return data
end

.search(args = {}) ⇒ Object



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/ugigi.rb', line 36

def self.search(args={})
  case args[:only]
  when :sosowa
    args = args.update(:sswp => 0, :compe => 0)
  when :compe
    args = args.update(:sswl => 0, :sswp => 0)
  when :sswp
    args = args.update(:sswl => 0, :compe => 0)
  end
  args.delete(:only) if args.has_key? :only
  data = send_req("search/list.json", args)
  indexes = []
  data.each do |e|
    index = Index.new(e)
    case args[:style]
    when :sosowa
      index.element = index.to_sosowa_index
      indexes << index
    else
      indexes << index
    end
  end
  return indexes
end

.total_count(args = {}) ⇒ Object



61
62
63
64
# File 'lib/ugigi.rb', line 61

def self.total_count(args={})
  data = send_req("search/list_count.json", args)
  return data["count"]
end