desmos 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +0 -1
- data/Gemfile.lock +0 -4
- data/VERSION +1 -1
- data/desmos.gemspec +2 -4
- data/lib/desmos.rb +3 -2
- data/lib/desmos/recursive_symbolize_keys.rb +19 -0
- data/lib/desmos/request_support.rb +1 -1
- data/lib/desmos/user.rb +2 -2
- metadata +14 -28
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -2,8 +2,6 @@ GEM
|
|
2
2
|
remote: http://rubygems.org/
|
3
3
|
specs:
|
4
4
|
ZenTest (4.6.2)
|
5
|
-
activesupport (3.1.0)
|
6
|
-
multi_json (~> 1.0)
|
7
5
|
addressable (2.2.6)
|
8
6
|
autotest (4.4.6)
|
9
7
|
ZenTest (>= 4.4.1)
|
@@ -15,7 +13,6 @@ GEM
|
|
15
13
|
bundler (~> 1.0.0)
|
16
14
|
git (>= 1.2.5)
|
17
15
|
rake
|
18
|
-
multi_json (1.0.3)
|
19
16
|
oauth (0.4.5)
|
20
17
|
rake (0.9.2)
|
21
18
|
rspec (2.6.0)
|
@@ -35,7 +32,6 @@ PLATFORMS
|
|
35
32
|
ruby
|
36
33
|
|
37
34
|
DEPENDENCIES
|
38
|
-
activesupport (~> 3.0)
|
39
35
|
autotest
|
40
36
|
awesome_print
|
41
37
|
jeweler
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.3
|
data/desmos.gemspec
CHANGED
@@ -5,7 +5,7 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{desmos}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = [%q{Ryan Moran}]
|
@@ -30,6 +30,7 @@ Gem::Specification.new do |s|
|
|
30
30
|
"lib/desmos/configuration.rb",
|
31
31
|
"lib/desmos/debug_mode.rb",
|
32
32
|
"lib/desmos/errors.rb",
|
33
|
+
"lib/desmos/recursive_symbolize_keys.rb",
|
33
34
|
"lib/desmos/request_support.rb",
|
34
35
|
"lib/desmos/student.rb",
|
35
36
|
"lib/desmos/tutor.rb",
|
@@ -58,7 +59,6 @@ Gem::Specification.new do |s|
|
|
58
59
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
59
60
|
s.add_runtime_dependency(%q<yajl-ruby>, ["~> 0.8.2"])
|
60
61
|
s.add_runtime_dependency(%q<oauth>, ["~> 0.4.5"])
|
61
|
-
s.add_runtime_dependency(%q<activesupport>, ["~> 3.0"])
|
62
62
|
s.add_development_dependency(%q<rspec>, [">= 0"])
|
63
63
|
s.add_development_dependency(%q<jeweler>, [">= 0"])
|
64
64
|
s.add_development_dependency(%q<autotest>, [">= 0"])
|
@@ -68,7 +68,6 @@ Gem::Specification.new do |s|
|
|
68
68
|
else
|
69
69
|
s.add_dependency(%q<yajl-ruby>, ["~> 0.8.2"])
|
70
70
|
s.add_dependency(%q<oauth>, ["~> 0.4.5"])
|
71
|
-
s.add_dependency(%q<activesupport>, ["~> 3.0"])
|
72
71
|
s.add_dependency(%q<rspec>, [">= 0"])
|
73
72
|
s.add_dependency(%q<jeweler>, [">= 0"])
|
74
73
|
s.add_dependency(%q<autotest>, [">= 0"])
|
@@ -79,7 +78,6 @@ Gem::Specification.new do |s|
|
|
79
78
|
else
|
80
79
|
s.add_dependency(%q<yajl-ruby>, ["~> 0.8.2"])
|
81
80
|
s.add_dependency(%q<oauth>, ["~> 0.4.5"])
|
82
|
-
s.add_dependency(%q<activesupport>, ["~> 3.0"])
|
83
81
|
s.add_dependency(%q<rspec>, [">= 0"])
|
84
82
|
s.add_dependency(%q<jeweler>, [">= 0"])
|
85
83
|
s.add_dependency(%q<autotest>, [">= 0"])
|
data/lib/desmos.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
require 'active_support/core_ext/hash/keys'
|
2
1
|
require 'oauth'
|
3
2
|
require 'yajl'
|
4
3
|
|
@@ -16,4 +15,6 @@ module Desmos
|
|
16
15
|
autoload :ConfigurationError, 'desmos/errors'
|
17
16
|
autoload :RequestError, 'desmos/errors'
|
18
17
|
autoload :WhiteboardNotFound, 'desmos/errors'
|
19
|
-
end
|
18
|
+
end
|
19
|
+
|
20
|
+
require 'desmos/recursive_symbolize_keys'
|
@@ -0,0 +1,19 @@
|
|
1
|
+
class Hash
|
2
|
+
|
3
|
+
def recursive_symbolize_keys
|
4
|
+
hash = {}
|
5
|
+
each_pair do |k,v|
|
6
|
+
if v.is_a?(Hash)
|
7
|
+
hash.store(k.to_sym,v.recursive_symbolize_keys)
|
8
|
+
else
|
9
|
+
hash.store(k.to_sym,v)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
hash
|
13
|
+
end
|
14
|
+
|
15
|
+
def recursive_symbolize_keys!
|
16
|
+
self.replace(recursive_symbolize_keys)
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
@@ -37,7 +37,7 @@ module Desmos
|
|
37
37
|
def parse_response(response)
|
38
38
|
debug "\n[RequestSupport.parse_response] (#{response.inspect})"
|
39
39
|
debug "response.body:\n#{response.body}"
|
40
|
-
parsed_response = Yajl::Parser.parse(response.body).
|
40
|
+
parsed_response = Yajl::Parser.parse(response.body).recursive_symbolize_keys
|
41
41
|
end
|
42
42
|
|
43
43
|
end
|
data/lib/desmos/user.rb
CHANGED
@@ -3,7 +3,7 @@ module Desmos
|
|
3
3
|
attr_accessor :id, :hash, :type, :name
|
4
4
|
|
5
5
|
def initialize(options = {})
|
6
|
-
options.
|
6
|
+
options.recursive_symbolize_keys!
|
7
7
|
@type = 'user'
|
8
8
|
@hash = options[:hash]
|
9
9
|
|
@@ -15,7 +15,7 @@ module Desmos
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def self.build_from_hash(options = {})
|
18
|
-
options.
|
18
|
+
options.recursive_symbolize_keys!
|
19
19
|
return if options[:id].blank?
|
20
20
|
return if options[:name].blank?
|
21
21
|
new(options)
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: desmos
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 29
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 3
|
10
|
+
version: 0.1.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Ryan Moran
|
@@ -53,17 +53,16 @@ dependencies:
|
|
53
53
|
requirement: &id003 !ruby/object:Gem::Requirement
|
54
54
|
none: false
|
55
55
|
requirements:
|
56
|
-
- -
|
56
|
+
- - ">="
|
57
57
|
- !ruby/object:Gem::Version
|
58
|
-
hash:
|
58
|
+
hash: 3
|
59
59
|
segments:
|
60
|
-
- 3
|
61
60
|
- 0
|
62
|
-
version: "
|
61
|
+
version: "0"
|
63
62
|
version_requirements: *id003
|
64
|
-
name:
|
63
|
+
name: rspec
|
65
64
|
prerelease: false
|
66
|
-
type: :
|
65
|
+
type: :development
|
67
66
|
- !ruby/object:Gem::Dependency
|
68
67
|
requirement: &id004 !ruby/object:Gem::Requirement
|
69
68
|
none: false
|
@@ -75,7 +74,7 @@ dependencies:
|
|
75
74
|
- 0
|
76
75
|
version: "0"
|
77
76
|
version_requirements: *id004
|
78
|
-
name:
|
77
|
+
name: jeweler
|
79
78
|
prerelease: false
|
80
79
|
type: :development
|
81
80
|
- !ruby/object:Gem::Dependency
|
@@ -89,7 +88,7 @@ dependencies:
|
|
89
88
|
- 0
|
90
89
|
version: "0"
|
91
90
|
version_requirements: *id005
|
92
|
-
name:
|
91
|
+
name: autotest
|
93
92
|
prerelease: false
|
94
93
|
type: :development
|
95
94
|
- !ruby/object:Gem::Dependency
|
@@ -103,7 +102,7 @@ dependencies:
|
|
103
102
|
- 0
|
104
103
|
version: "0"
|
105
104
|
version_requirements: *id006
|
106
|
-
name:
|
105
|
+
name: awesome_print
|
107
106
|
prerelease: false
|
108
107
|
type: :development
|
109
108
|
- !ruby/object:Gem::Dependency
|
@@ -117,25 +116,11 @@ dependencies:
|
|
117
116
|
- 0
|
118
117
|
version: "0"
|
119
118
|
version_requirements: *id007
|
120
|
-
name: awesome_print
|
121
|
-
prerelease: false
|
122
|
-
type: :development
|
123
|
-
- !ruby/object:Gem::Dependency
|
124
|
-
requirement: &id008 !ruby/object:Gem::Requirement
|
125
|
-
none: false
|
126
|
-
requirements:
|
127
|
-
- - ">="
|
128
|
-
- !ruby/object:Gem::Version
|
129
|
-
hash: 3
|
130
|
-
segments:
|
131
|
-
- 0
|
132
|
-
version: "0"
|
133
|
-
version_requirements: *id008
|
134
119
|
name: webmock
|
135
120
|
prerelease: false
|
136
121
|
type: :development
|
137
122
|
- !ruby/object:Gem::Dependency
|
138
|
-
requirement: &
|
123
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
139
124
|
none: false
|
140
125
|
requirements:
|
141
126
|
- - ">="
|
@@ -146,7 +131,7 @@ dependencies:
|
|
146
131
|
- 2
|
147
132
|
- 9
|
148
133
|
version: 1.2.9
|
149
|
-
version_requirements: *
|
134
|
+
version_requirements: *id008
|
150
135
|
name: rspec
|
151
136
|
prerelease: false
|
152
137
|
type: :development
|
@@ -173,6 +158,7 @@ files:
|
|
173
158
|
- lib/desmos/configuration.rb
|
174
159
|
- lib/desmos/debug_mode.rb
|
175
160
|
- lib/desmos/errors.rb
|
161
|
+
- lib/desmos/recursive_symbolize_keys.rb
|
176
162
|
- lib/desmos/request_support.rb
|
177
163
|
- lib/desmos/student.rb
|
178
164
|
- lib/desmos/tutor.rb
|