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 +4 -4
- data/lib/sched/client.rb +11 -6
- data/lib/sched/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1ad83f48e8e20fa1a91d9867096a61d6c9ac532b
|
4
|
+
data.tar.gz: 9849dff63258b57508a46e97de3a8de17f9f9183
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 47120b7a3fbd6c2657c5cf0deeeefaf631c02cb6ae58bf6ab03e04bdd1b994a28c527c5631a36a2f51f3aadd0cb0d33b599163c7294716410eb6d1a10a31af1c
|
7
|
+
data.tar.gz: ac483adb2052f01de5bb3731c0d503e9990d6e1aaca8552efbf047d4223871f1b0ac803bea2eb43dcfdf7d69a404c472d9320fab0f6f97a02673e03c20ff6c7d
|
data/lib/sched/client.rb
CHANGED
@@ -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.
|
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
|
data/lib/sched/version.rb
CHANGED
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.
|
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-
|
11
|
+
date: 2016-05-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: curb
|