whatcd 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (2) hide show
  1. data/lib/whatcd.rb +17 -1
  2. metadata +3 -3
@@ -35,6 +35,16 @@ class WhatCD
35
35
  headers.has_key? 'Cookie'
36
36
  end
37
37
 
38
+ # Public: Gets a Rippy quote.
39
+ #
40
+ # Returns a String.
41
+ def rippy
42
+ result = get '/ajax.php', query: { action: 'rippy', format: 'json' }
43
+ result['rippy']
44
+ end
45
+
46
+ alias_method :Rippy, :rippy
47
+
38
48
  # Internal: Makes a request.
39
49
  #
40
50
  # action - An action name String.
@@ -53,7 +63,7 @@ class WhatCD
53
63
  end
54
64
  end
55
65
 
56
- # Public: Make a request. The "method" name (capitalized!) is one of the
66
+ # Public: Makes a request. The "method" name (capitalized!) is one of the
57
67
  # API actions (ajax.php?action=<this-bit>).
58
68
  #
59
69
  # query - A query Hash.
@@ -73,6 +83,12 @@ class WhatCD
73
83
  super
74
84
  end
75
85
  end
86
+
87
+ # Public: Makes a request. See method_missing for usage. Only defined for
88
+ # actions without parameters (e.g. Rippy).
89
+ def const_missing(constant)
90
+ constant == :Rippy ? rippy : super
91
+ end
76
92
  end
77
93
 
78
94
  # Internal: Gets raised whenever failure occured. Error messages will be
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: whatcd
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-08-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: httparty
16
- requirement: &2157115900 !ruby/object:Gem::Requirement
16
+ requirement: &2161169000 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *2157115900
24
+ version_requirements: *2161169000
25
25
  description: An API wrapper for What.cd's JSON API
26
26
  email:
27
27
  - paulbrickfeld@gmail.com