nitroapi 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- nitroapi (0.0.6)
4
+ nitroapi (0.0.8)
5
5
  activesupport
6
6
  json
7
7
 
@@ -173,5 +173,13 @@ module NitroApi
173
173
  def to_query params
174
174
  URI.escape(params.map { |k,v| "#{k.to_s}=#{v.to_s}" }.join("&"))
175
175
  end
176
+
177
+ def symbolize_keys h
178
+ result = {}
179
+ h.keys.each do |key|
180
+ result[(key.to_sym rescue key) || key] = h[key]
181
+ end
182
+ result
183
+ end
176
184
  end
177
185
  end
@@ -1,6 +1,7 @@
1
1
  module NitroApi
2
2
  module SiteCalls
3
3
  def make_points_leaders_call opts
4
+ opts = symbolize_keys opts
4
5
  params = {
5
6
  :method => 'site.getPointsLeaders'
6
7
  }
@@ -10,18 +11,18 @@ module NitroApi
10
11
  params[:sessionKey] = @session if @session
11
12
 
12
13
  opts_list = {
13
- 'criteria' => 'criteria',
14
- 'point_category' => 'pointCategory',
15
- 'return_count' => 'returnCount',
16
- 'start' => 'start',
17
- 'duration' => 'duration',
18
- 'user_ids' => 'userIds',
19
- 'tags' => 'tags',
20
- 'tags_operator' => 'tagsOperator',
21
- 'group_name' => 'groupName',
22
- 'with_rank' => 'withRank',
23
- 'with_surrounding_users' => 'withSurroundingUsers',
24
- 'preferences' => 'preferences'
14
+ criteria: 'criteria',
15
+ point_category: 'pointCategory',
16
+ return_count: 'returnCount',
17
+ start: 'start',
18
+ duration: 'duration',
19
+ user_ids: 'userIds',
20
+ tags: 'tags',
21
+ tags_operator: 'tagsOperator',
22
+ group_name: 'groupName',
23
+ with_rank: 'withRank',
24
+ with_surrounding_users: 'withSurroundingUsers',
25
+ preferences: 'preferences'
25
26
  }
26
27
 
27
28
  opts.each do |key,value|
@@ -129,6 +129,7 @@ module NitroApi
129
129
  end
130
130
 
131
131
  def make_get_points_balance_call opts={}
132
+ opts = symbolize_keys opts
132
133
  params = {
133
134
  :method => 'user.getPointsBalance'
134
135
  }
@@ -138,12 +139,12 @@ module NitroApi
138
139
  params[:sessionKey] = @session if @session
139
140
 
140
141
  opts_list = {
141
- 'criteria' => 'criteria',
142
- 'point_category' => 'pointCategory',
143
- 'start' => 'start',
144
- 'end' => 'end',
145
- 'user_id' => 'userId',
146
- 'tags' => 'tags',
142
+ criteria: 'criteria',
143
+ point_category: 'pointCategory',
144
+ start: 'start',
145
+ end: 'end',
146
+ user_id: 'userId',
147
+ tags: 'tags',
147
148
  }
148
149
 
149
150
  opts.each do |key,value|
@@ -1,3 +1,3 @@
1
1
  module NitroApi
2
- VERSION = "0.0.7"
2
+ VERSION = "0.0.8"
3
3
  end
@@ -245,12 +245,12 @@ describe NitroApi do
245
245
 
246
246
  it "passes through all the expected parameters" do
247
247
  options = {
248
- 'point_category' => 'other_points',
249
- 'criteria' => 'BALANCE',
250
- 'start' => '1354636962',
251
- 'end' => '1354637015',
252
- 'tags' => 'beans,rice',
253
- 'user_id' => 'another_user',
248
+ point_category: 'other_points',
249
+ criteria: 'BALANCE',
250
+ start: '1354636962',
251
+ end: '1354637015',
252
+ tags: 'beans,rice',
253
+ user_id: 'another_user',
254
254
  }
255
255
  url = @nitro.base_url + '?criteria=BALANCE&end=1354637015&method=user.getPointsBalance&pointCategory=other_points&sessionKey=1&start=1354636962&tags=beans,rice&userId=another_user'
256
256
  stub_http_request(:get, url).
@@ -261,13 +261,13 @@ describe NitroApi do
261
261
 
262
262
  it "passes through only the expected parameters" do
263
263
  options = {
264
- 'point_category' => 'other_points',
265
- 'criteria' => 'BALANCE',
266
- 'start' => '1354636962',
267
- 'end' => '1354637015',
268
- 'tags' => 'beans,rice',
269
- 'user_id' => 'another_user',
270
- 'non_param' => 'some_unknown_param'
264
+ point_category: 'other_points',
265
+ criteria: 'BALANCE',
266
+ start: '1354636962',
267
+ end: '1354637015',
268
+ tags: 'beans,rice',
269
+ user_id: 'another_user',
270
+ non_param: 'some_unknown_param'
271
271
  }
272
272
  url = @nitro.base_url + '?criteria=BALANCE&end=1354637015&method=user.getPointsBalance&pointCategory=other_points&sessionKey=1&start=1354636962&tags=beans,rice&userId=another_user'
273
273
  stub_http_request(:get, url).
@@ -280,10 +280,10 @@ describe NitroApi do
280
280
  describe "#get_points_leaders options_hash" do
281
281
  it "gets points leaders" do
282
282
  options = {
283
- 'return_count' => 20,
284
- 'duration' => 'ALLTIME',
285
- 'point_category' => 'points',
286
- 'criteria' => 'CREDITS'
283
+ return_count: 20,
284
+ duration: 'ALLTIME',
285
+ point_category: 'points',
286
+ criteria: 'CREDITS'
287
287
  }
288
288
 
289
289
  results = { 'Nitro' => {
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.7
4
+ version: 0.0.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-12-05 00:00:00.000000000 Z
13
+ date: 2012-12-06 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport