sched 0.1.8 → 0.1.9

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d5eac01d5991bee9cc447616c813b14969521e89
4
- data.tar.gz: b211ae4f06d48638cde04122d48671b0a2552d4c
3
+ metadata.gz: 1ad83f48e8e20fa1a91d9867096a61d6c9ac532b
4
+ data.tar.gz: 9849dff63258b57508a46e97de3a8de17f9f9183
5
5
  SHA512:
6
- metadata.gz: ea3b43024a511a803eaea8f5a0223262fc60c71b815c3f7665693156d594a0af61f54f8b65b7df8ec00e28e017b580e51881048ca4239df7217d74c831d32558
7
- data.tar.gz: 71cfbfe5b4c4f6a114603f03a01cdba5139945a0f40ff414b4572f4f65d52289db01d119c68ab3becf15e93fabd433a8a8aed846564dc2c5eacc1015290eec6d
6
+ metadata.gz: 47120b7a3fbd6c2657c5cf0deeeefaf631c02cb6ae58bf6ab03e04bdd1b994a28c527c5631a36a2f51f3aadd0cb0d33b599163c7294716410eb6d1a10a31af1c
7
+ data.tar.gz: ac483adb2052f01de5bb3731c0d503e9990d6e1aaca8552efbf047d4223871f1b0ac803bea2eb43dcfdf7d69a404c472d9320fab0f6f97a02673e03c20ff6c7d
@@ -32,12 +32,20 @@ module Sched
32
32
 
33
33
  private
34
34
 
35
+ def byte_order_mark
36
+ "\xEF\xBB\xBF".force_encoding("UTF-8")
37
+ end
38
+
35
39
  def curl_client(path)
36
40
  c = Curl::Easy.new("#{api_url}/#{path}")
37
41
  c.headers["User-Agent"] = "sched-gem"
38
42
  c
39
43
  end
40
44
 
45
+ def encoded(str)
46
+ str.force_encoding("UTF-8").gsub(byte_order_mark, "")
47
+ end
48
+
41
49
  def full_url(path)
42
50
  "#{api_url}/#{path}"
43
51
  end
@@ -46,15 +54,12 @@ module Sched
46
54
  get_attributes = data.map { |key, value| "#{key}=#{value}" }.join("&")
47
55
  c = curl_client("#{path}?#{get_attributes}")
48
56
  c.perform
49
- c.body_str
57
+ encoded(c.body_str)
50
58
  end
51
59
 
52
60
  def parse_attributes(attributes)
53
61
  attributes.map do |a|
54
- a.force_encoding("UTF-8")
55
- .strip.gsub(/[\u0080-\u00ff]/, "")
56
- .gsub(/^event_/, "session_")
57
- .to_sym
62
+ a.gsub(/^event_/, "session_").to_sym
58
63
  end
59
64
  end
60
65
 
@@ -75,7 +80,7 @@ module Sched
75
80
  end
76
81
  c = curl_client(path)
77
82
  c.http_post(post_fields)
78
- c.body_str
83
+ encoded(c.body_str)
79
84
  end
80
85
  end
81
86
  end
@@ -1,3 +1,3 @@
1
1
  module Sched
2
- VERSION = "0.1.8".freeze unless Sched.const_defined?("VERSION")
2
+ VERSION = "0.1.9".freeze unless Sched.const_defined?("VERSION")
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sched
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Inge Jørgensen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-20 00:00:00.000000000 Z
11
+ date: 2016-05-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: curb