namey 0.0.9 → 0.0.10

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7f320c1ddb09bf1cc1c10663965949acafcce32d
4
- data.tar.gz: a5f73434c7fe00392070f9d88b053aafddff3ad2
3
+ metadata.gz: fa5a09d5a8963ae86584590f9e2d7d703546962c
4
+ data.tar.gz: 1d7d4ee745e34d96bae0908018d8342745e6288d
5
5
  SHA512:
6
- metadata.gz: a2b993038638bee8bbaebc224cdf9c0522f7ee64bf6d0983ad4a25d1ad6fe4012d73a6acb0fe250c40bfcfafb6a0d9530310a6f28540bb487dc7aa0044d67e73
7
- data.tar.gz: f67f9d2b65f84d903c95826aa3627e7bd0873de0c0608cc595d22db8202e825f2ab9f2e23f37e7e05eb7d499f8db7ea10d21ab8f27541e4527ed647393e63a5e
6
+ metadata.gz: 4e80f8deb12e4a83d7d6284fdb4ed092b5b48101ff8afd4ca2797c5ccb7f8071b236fbbf11623077b1674d2b62f5184d02a783e2d6a367867673e65684860b50
7
+ data.tar.gz: ab56ece4af77c5d9f140c381e041bec2f488aac035d1c4ed933334fddd08349d781b050a75478707bd1dd8f3d9cd6622d4c099bd3d2c968e1c78aa6cd1c9a2ea
@@ -41,7 +41,11 @@ get '/name.?:format?' do
41
41
  :frequency => :common
42
42
  }.merge(params.symbolize_keys!)
43
43
 
44
- opts[:with_surname] = true if params[:with_surname] == "true"
44
+ if params[:with_surname] == "true"
45
+ opts[:with_surname] = true
46
+ else
47
+ opts[:with_surname] = false
48
+ end
45
49
 
46
50
  [:type, :frequency].each do |key|
47
51
  opts[key] = opts[key].to_sym if opts.has_key?(key)
@@ -43,7 +43,8 @@ namey = {
43
43
  */
44
44
  get : function(options) {
45
45
  var callback;
46
- var tmp_params = [];
46
+ var tmp_params = {};
47
+ var host = "namey.muffinlabs.com";
47
48
 
48
49
  if ( typeof(options) == "function" ) {
49
50
  callback = options;
@@ -51,32 +52,33 @@ namey = {
51
52
  else if ( typeof(options) == "object" ) {
52
53
  callback = options.callback;
53
54
 
54
- if ( typeof(options.host) === "undefined" ) {
55
- options.host = "namey.muffinlabs.com";
55
+ if ( typeof(options.host) !== "undefined" ) {
56
+ host = options.host;
56
57
  }
57
58
 
58
59
  if ( typeof(options.count) == "undefined" ) {
59
60
  options.count = 1;
60
61
  }
61
- tmp_params.push("count=" + options.count);
62
+ tmp_params.count = options.count;
62
63
 
63
64
  if ( typeof(options.type) != "undefined" && options.type != "both" ) {
64
- tmp_params.push("type=" + options.type);
65
+ tmp_params.type = options.type;
65
66
  };
66
67
 
67
68
  if ( options.type != "surname" && typeof(options.with_surname) != "undefined" ) {
68
- tmp_params.push("with_surname=" + options.with_surname);
69
+ tmp_params.with_surname = options.with_surname;
69
70
  }
70
71
  if ( options.min_freq ) {
71
- tmp_params.push("min_freq=" + options.min_freq);
72
- tmp_params.push("max_freq=" + options.max_freq);
72
+ tmp_params.min_freq = options.min_freq;
73
+ tmp_params.max_freq = options.max_freq;
73
74
  }
74
75
  else if ( typeof(options.frequency) != "undefined" ) {
75
- tmp_params.push("frequency=" + options.frequency);
76
+ tmp_params.frequency = options.frequency;
76
77
  }
78
+
77
79
  }
78
80
 
79
- this.jsonP.get('//' + options.host + '/name.json', tmp_params, function(d) {
81
+ this.jsonP.get('//' + host + '/name.json', tmp_params, function(d) {
80
82
  if ( typeof(callback) == "function" ) {
81
83
  callback(d);
82
84
  }
@@ -1,4 +1,4 @@
1
1
  module Namey
2
2
  NAME = "namey"
3
- VERSION = "0.0.9"
3
+ VERSION = "0.0.10"
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: namey
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.9
4
+ version: 0.0.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Colin Mitchell