lessonly-ruby 0.1.2 → 0.1.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8b5cecbb69fe5303ada506637af065387758e378
4
- data.tar.gz: 8833f70919afd4358def7d8a98b9cd5a1b678f07
3
+ metadata.gz: 43127482ad78f67b1ff4e9008d28b16713f9e00a
4
+ data.tar.gz: 1ad1e676d06e0d90104dc0d4ccb4658b57462a9c
5
5
  SHA512:
6
- metadata.gz: e440339dbe961c44b3cb12666fc5d1df320fd41640990d8829e64a008a03d49bb6d8cf87f9d6f99d5d9c33835f44fca1ea744950f866d1751d7b151e82d14812
7
- data.tar.gz: bba9b53af4332a4be683746548097a0bdfce5a9c9f8ba3d13c6302f44a4ebbde49b04f794d1e9628e471ca6401cdfe63a050b9451e793d7529fd9f0631f62f26
6
+ metadata.gz: 844a274ed27e25893ab26fa5b4a6beadeeccc6788a093b5e1fc8436590bfa0a8feeecf2aacbd94054193e5cdb78f4fa33cb17ba305c036d1c85dac5f64b37ecb
7
+ data.tar.gz: 4ee40c66a3a6e2cc400a76c2b613ae5d75b32dc367c7a559d32bcfcc1880b6db674fd02919a307fecf7827a4d364adb64829f7e2b7a1361ba30873f0e9efb033
@@ -3,5 +3,11 @@ module Lessonly
3
3
  def assigned_to?(course)
4
4
  course.assignments.map(&:assignee_id).include?(id)
5
5
  end
6
+
7
+ def serialize
8
+ blacklist = /[`!@#\$%\^&\*\+=\(\)\|\[\];]/
9
+ attrs[:name] = name.gsub(blacklist, '').strip.squeeze(' ')
10
+ self
11
+ end
6
12
  end
7
13
  end
@@ -1,13 +1,8 @@
1
1
  module Lessonly
2
2
  class Serializer < Sawyer::Serializer
3
3
  def encode_object(resource)
4
+ return resource.serialize if resource.respond_to? :serialize
4
5
  resource
5
- # return resource.serialize if resource.respond_to? :serialize
6
- # case resource
7
- # when Hash then encode_hash(resource)
8
- # when Array then resource.map { |o| encode_object(o) }
9
- # else resource
10
- # end
11
6
  end
12
7
 
13
8
  def time_field?(key, value)
@@ -1,3 +1,3 @@
1
1
  module Lessonly
2
- VERSION = '0.1.2'
2
+ VERSION = '0.1.3'
3
3
  end
@@ -30,4 +30,16 @@ describe Lessonly::User do
30
30
  expect(user.assigned_to?(course)).to eq false
31
31
  end
32
32
  end
33
+
34
+ describe '#serialize' do
35
+ let(:agent) { Sawyer::Agent.new('') }
36
+ subject do
37
+ Lessonly::User.new(agent, name: 'Test++ +User!!@', role: 'learner',
38
+ email: 'user@example.com')
39
+ end
40
+
41
+ it 'should remove invalid characters' do
42
+ expect(subject.serialize.name).to eq 'Test User'
43
+ end
44
+ end
33
45
  end
metadata CHANGED
@@ -1,153 +1,153 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lessonly-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Skylar Anderson
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-01 00:00:00.000000000 Z
11
+ date: 2015-09-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gem_config
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ">="
17
+ - - '>='
18
18
  - !ruby/object:Gem::Version
19
19
  version: '0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ">="
24
+ - - '>='
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: sawyer
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ~>
32
32
  - !ruby/object:Gem::Version
33
33
  version: 0.5.3
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ~>
39
39
  - !ruby/object:Gem::Version
40
40
  version: 0.5.3
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: activesupport
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - '>='
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - '>='
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: bundler
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ~>
60
60
  - !ruby/object:Gem::Version
61
61
  version: '1.3'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - ~>
67
67
  - !ruby/object:Gem::Version
68
68
  version: '1.3'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: aptible-tasks
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ">="
73
+ - - '>='
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ">="
80
+ - - '>='
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: rake
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ">="
87
+ - - '>='
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ">="
94
+ - - '>='
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: rspec
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ">="
101
+ - - '>='
102
102
  - !ruby/object:Gem::Version
103
103
  version: '0'
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - ">="
108
+ - - '>='
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: webmock
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - ">="
115
+ - - '>='
116
116
  - !ruby/object:Gem::Version
117
117
  version: '0'
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - ">="
122
+ - - '>='
123
123
  - !ruby/object:Gem::Version
124
124
  version: '0'
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: pry
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - ">="
129
+ - - '>='
130
130
  - !ruby/object:Gem::Version
131
131
  version: '0'
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - ">="
136
+ - - '>='
137
137
  - !ruby/object:Gem::Version
138
138
  version: '0'
139
139
  - !ruby/object:Gem::Dependency
140
140
  name: sinatra
141
141
  requirement: !ruby/object:Gem::Requirement
142
142
  requirements:
143
- - - ">="
143
+ - - '>='
144
144
  - !ruby/object:Gem::Version
145
145
  version: '0'
146
146
  type: :development
147
147
  prerelease: false
148
148
  version_requirements: !ruby/object:Gem::Requirement
149
149
  requirements:
150
- - - ">="
150
+ - - '>='
151
151
  - !ruby/object:Gem::Version
152
152
  version: '0'
153
153
  description: Ruby client for Lesson.ly API
@@ -157,9 +157,9 @@ executables: []
157
157
  extensions: []
158
158
  extra_rdoc_files: []
159
159
  files:
160
- - ".gitignore"
161
- - ".rspec"
162
- - ".travis.yml"
160
+ - .gitignore
161
+ - .rspec
162
+ - .travis.yml
163
163
  - Gemfile
164
164
  - LICENSE.md
165
165
  - Procfile
@@ -205,12 +205,12 @@ require_paths:
205
205
  - lib
206
206
  required_ruby_version: !ruby/object:Gem::Requirement
207
207
  requirements:
208
- - - ">="
208
+ - - '>='
209
209
  - !ruby/object:Gem::Version
210
210
  version: '0'
211
211
  required_rubygems_version: !ruby/object:Gem::Requirement
212
212
  requirements:
213
- - - ">="
213
+ - - '>='
214
214
  - !ruby/object:Gem::Version
215
215
  version: '0'
216
216
  requirements: []