Class: Proz::WiwoEntries

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/proz/wiwo_entries.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key:) ⇒ WiwoEntries

Returns a new instance of WiwoEntries.



9
10
11
# File 'lib/proz/wiwo_entries.rb', line 9

def initialize(key:)
  @key = key
end

Instance Attribute Details

#keyObject (readonly)

Returns the value of attribute key.



8
9
10
# File 'lib/proz/wiwo_entries.rb', line 8

def key
  @key
end

Instance Method Details

#entriesObject



13
14
15
# File 'lib/proz/wiwo_entries.rb', line 13

def entries
  all_wiwos
end

#filtered_entries(**options) ⇒ Object



25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/proz/wiwo_entries.rb', line 25

def filtered_entries(**options)
  if options[:user_uuid]
    user_uuid_query = "user_uuid=" + options[:user_uuid] + '&'
  else
    user_uuid_query = ""
  end
  if options[:keyword]
    keyword_query = "message_contains=" + URI.encode(options[:keyword], /\W/) + '&'
  else
    keyword_query = ""
  end
  if options[:min_time]
    min_time_query = "min_time=" + URI.encode(options[:min_time]) + '&'
  else
    min_time_query = ""
  end
  self.class.get("/wiwo?" + user_uuid_query + keyword_query + min_time_query, headers: { 'X-Proz-API-Key' => key })
end

#usersObject



21
22
23
# File 'lib/proz/wiwo_entries.rb', line 21

def users
  all_wiwos["users"]
end

#wiwosObject



17
18
19
# File 'lib/proz/wiwo_entries.rb', line 17

def wiwos
  all_wiwos["wiwos"]
end