nitroapi 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/examples/log_and_check_status.rb +1 -0
- data/lib/nitro_api.rb +9 -4
- data/nitroapi.gemspec +2 -2
- data/spec/nitro_api_spec.rb +1 -1
- metadata +15 -15
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.4
|
data/lib/nitro_api.rb
CHANGED
@@ -71,7 +71,8 @@ module NitroApi
|
|
71
71
|
response = make_call(params)
|
72
72
|
|
73
73
|
if response['challenges']
|
74
|
-
response['challenges']['Challenge']
|
74
|
+
items = ensure_array(response['challenges']['Challenge'])
|
75
|
+
items.reduce([]) do |challenges, item|
|
75
76
|
challenge = Challenge.new
|
76
77
|
challenge.name = item["name"]
|
77
78
|
challenge.description = item["description"]
|
@@ -79,8 +80,7 @@ module NitroApi
|
|
79
80
|
challenge.thumb_url = item["thumbUrl"]
|
80
81
|
challenge.completed = item["completionCount"].to_i
|
81
82
|
|
82
|
-
challenges
|
83
|
-
challenges
|
83
|
+
challenges<< challenge
|
84
84
|
end
|
85
85
|
end
|
86
86
|
end
|
@@ -105,7 +105,8 @@ module NitroApi
|
|
105
105
|
end
|
106
106
|
response = make_call(params)
|
107
107
|
if response['ActionHistoryRecord']
|
108
|
-
response['ActionHistoryRecord']['ActionHistoryItem']
|
108
|
+
items = ensure_array(response['ActionHistoryRecord']['ActionHistoryItem'])
|
109
|
+
items.reduce([]) do
|
109
110
|
|history, item|
|
110
111
|
history<< {:tags => item['tags'],
|
111
112
|
:ts => Time.at(item['ts'].to_i),
|
@@ -128,6 +129,10 @@ module NitroApi
|
|
128
129
|
|
129
130
|
private
|
130
131
|
|
132
|
+
def ensure_array(items)
|
133
|
+
items.is_a?(Array) ? items : [items]
|
134
|
+
end
|
135
|
+
|
131
136
|
def make_call(params)
|
132
137
|
request = HOST + ACCEPT + to_query(params)
|
133
138
|
data = Net::HTTP.get(URI.parse(request))
|
data/nitroapi.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{nitroapi}
|
8
|
-
s.version = "0.0.
|
8
|
+
s.version = "0.0.4"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Gilad Buchman"]
|
12
|
-
s.date = %q{2011-08-
|
12
|
+
s.date = %q{2011-08-10}
|
13
13
|
s.description = %q{Api client for Bunchball's Nitro. http://www.bunchball.com/nitro/}
|
14
14
|
s.extra_rdoc_files = [
|
15
15
|
"LICENSE.txt",
|
data/spec/nitro_api_spec.rb
CHANGED
@@ -84,7 +84,7 @@ describe NitroApi do
|
|
84
84
|
|
85
85
|
progress = @nitro.challenge_progress
|
86
86
|
progress.should_not be_empty
|
87
|
-
challenge = progress[
|
87
|
+
challenge = progress[0]
|
88
88
|
challenge.should_not be_nil
|
89
89
|
challenge.description.should == "some description"
|
90
90
|
challenge.completed.should == 1
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nitroapi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,12 +9,12 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-08-
|
12
|
+
date: 2011-08-10 00:00:00.000000000 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activesupport
|
17
|
-
requirement: &
|
17
|
+
requirement: &2151908000 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ! '>='
|
@@ -22,10 +22,10 @@ dependencies:
|
|
22
22
|
version: '0'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *2151908000
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: json
|
28
|
-
requirement: &
|
28
|
+
requirement: &2151907060 !ruby/object:Gem::Requirement
|
29
29
|
none: false
|
30
30
|
requirements:
|
31
31
|
- - ! '>='
|
@@ -33,10 +33,10 @@ dependencies:
|
|
33
33
|
version: '0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
|
-
version_requirements: *
|
36
|
+
version_requirements: *2151907060
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
name: rspec
|
39
|
-
requirement: &
|
39
|
+
requirement: &2151906000 !ruby/object:Gem::Requirement
|
40
40
|
none: false
|
41
41
|
requirements:
|
42
42
|
- - ~>
|
@@ -44,10 +44,10 @@ dependencies:
|
|
44
44
|
version: 2.3.0
|
45
45
|
type: :development
|
46
46
|
prerelease: false
|
47
|
-
version_requirements: *
|
47
|
+
version_requirements: *2151906000
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
49
|
name: bundler
|
50
|
-
requirement: &
|
50
|
+
requirement: &2151905240 !ruby/object:Gem::Requirement
|
51
51
|
none: false
|
52
52
|
requirements:
|
53
53
|
- - ~>
|
@@ -55,10 +55,10 @@ dependencies:
|
|
55
55
|
version: 1.0.0
|
56
56
|
type: :development
|
57
57
|
prerelease: false
|
58
|
-
version_requirements: *
|
58
|
+
version_requirements: *2151905240
|
59
59
|
- !ruby/object:Gem::Dependency
|
60
60
|
name: jeweler
|
61
|
-
requirement: &
|
61
|
+
requirement: &2151904000 !ruby/object:Gem::Requirement
|
62
62
|
none: false
|
63
63
|
requirements:
|
64
64
|
- - ~>
|
@@ -66,10 +66,10 @@ dependencies:
|
|
66
66
|
version: 1.6.4
|
67
67
|
type: :development
|
68
68
|
prerelease: false
|
69
|
-
version_requirements: *
|
69
|
+
version_requirements: *2151904000
|
70
70
|
- !ruby/object:Gem::Dependency
|
71
71
|
name: rcov
|
72
|
-
requirement: &
|
72
|
+
requirement: &2151901500 !ruby/object:Gem::Requirement
|
73
73
|
none: false
|
74
74
|
requirements:
|
75
75
|
- - ! '>='
|
@@ -77,7 +77,7 @@ dependencies:
|
|
77
77
|
version: '0'
|
78
78
|
type: :development
|
79
79
|
prerelease: false
|
80
|
-
version_requirements: *
|
80
|
+
version_requirements: *2151901500
|
81
81
|
description: Api client for Bunchball's Nitro. http://www.bunchball.com/nitro/
|
82
82
|
email:
|
83
83
|
executables: []
|
@@ -118,7 +118,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
118
118
|
version: '0'
|
119
119
|
segments:
|
120
120
|
- 0
|
121
|
-
hash: -
|
121
|
+
hash: -4027445193306641225
|
122
122
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
123
123
|
none: false
|
124
124
|
requirements:
|