yamwow 0.0.13 → 0.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -62,6 +62,7 @@ module YamWow
62
62
  def build_messages(messages_data, reference_data)
63
63
  messages_data.select { |m| m['replied_to_id'].nil? }.each do |m|
64
64
  m['like_count'] = m['liked_by']['count'].to_i
65
+ m['sender_tag'] = "[[user:#{m['sender_id']}]]"
65
66
  end
66
67
  end
67
68
 
@@ -15,9 +15,9 @@ module YamWow
15
15
  def get_messages_with_praise_topic
16
16
  r = MessagesWithTopicRequest.new(@client, 'praise', @options).send
17
17
  r.data.each do |m|
18
- m['reason'] = reason m
19
- m['recipient_names'] = recipient_names m
20
- m['recipient_tags'] = recipient_tags m
18
+ m['praise_message'] = reason m
19
+ m['praise_recipient_names'] = recipient_names m
20
+ m['praise_recipient_tags'] = recipient_tags m
21
21
  end
22
22
  r
23
23
  end
@@ -12,7 +12,7 @@ module YamWow
12
12
  def send
13
13
  @topics = []
14
14
  process_range '0', '9'
15
- process_range 'a', 'z'
15
+ #process_range 'a', 'z'
16
16
  @topics.uniq! { |t| t['id'] }
17
17
  @topics.sort! { |x, y| x['name'].downcase <=> y['name'].downcase }
18
18
  Response.new @topics
@@ -24,8 +24,8 @@ module YamWow
24
24
  end
25
25
 
26
26
  def add_details(topic)
27
- detailed_topic = get_detailed_topic topic['id']
28
- topic.merge! detailed_topic
27
+ r = get_detailed_topic topic['id']
28
+ topic.merge! r.data
29
29
  end
30
30
 
31
31
  def get_detailed_topic(topic_id)
@@ -12,8 +12,7 @@ module YamWow
12
12
  end
13
13
 
14
14
  def to_csv(options={})
15
- data = @data.kind_of?(Array) ? @data : [@data]
16
- hashes = data.map { |h| h.flatten_with_path }
15
+ hashes = flatten_data
17
16
  columns = options[:include]
18
17
 
19
18
  unless columns
@@ -31,5 +30,23 @@ module YamWow
31
30
  end
32
31
  end
33
32
 
33
+ def to_s(template=nil)
34
+ return super unless template
35
+ keys = template.scan(/(\{(.+?)\})/m)
36
+ results = flatten_data.map do |h|
37
+ t = "#{template}"
38
+ keys.each { |k| t.gsub! k[0], h[k[1]].to_s.gsub("\n", ' ') }
39
+ t
40
+ end
41
+ results.join
42
+ end
43
+
44
+ private
45
+
46
+ def flatten_data
47
+ data = @data.kind_of?(Array) ? @data : [@data]
48
+ data.map { |h| h.flatten_with_path }
49
+ end
50
+
34
51
  end
35
52
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yamwow
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.13
4
+ version: 0.0.15
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-02-13 00:00:00.000000000 Z
12
+ date: 2013-02-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: yam
16
- requirement: &70109314411340 !ruby/object:Gem::Requirement
16
+ requirement: &70202395055020 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70109314411340
24
+ version_requirements: *70202395055020
25
25
  description:
26
26
  email: matthew-github@matthewriley.name
27
27
  executables: []