surveymonkey 0.2.1 → 0.2.2
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 +4 -4
- data/lib/surveymonkey/api.rb +16 -2
- data/lib/surveymonkey/api/method.rb +10 -3
- data/lib/surveymonkey/client.rb +7 -0
- data/lib/surveymonkey/request.rb +13 -1
- data/lib/surveymonkey/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6b64132d5d1febf1ea23a672a432bda1c3f87db7
|
4
|
+
data.tar.gz: f956f7dfba34dd84c1d2ebd858ffd1c336301063
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a708772e0e48a25ac487c2fdae8904d91a97b3e77893459a9b69b8a8066f96f33123d0001351942c4b7e2f222dc59c71c58a6ad2e74d5329888d237a7cace4f4
|
7
|
+
data.tar.gz: 0ba7c59b97a3595a275965bc9c320e5766ee2a1aacd7d38faa9bf8673a81179d3bb12d0ba97fe5858335710b30d3b0fedba7a353c61022ab5d346c61a71cae8b
|
data/lib/surveymonkey/api.rb
CHANGED
@@ -9,6 +9,11 @@ class Surveymonkey::API
|
|
9
9
|
|
10
10
|
# constants
|
11
11
|
|
12
|
+
##
|
13
|
+
# String indicated the version of the SurveyMonkey API implemented.
|
14
|
+
|
15
|
+
Api_version = 'v2'
|
16
|
+
|
12
17
|
##
|
13
18
|
# Hash defining the methods in the SurveyMonkey API. Current as of 2015-05-05.
|
14
19
|
|
@@ -49,7 +54,7 @@ class Surveymonkey::API
|
|
49
54
|
}
|
50
55
|
|
51
56
|
# public methods
|
52
|
-
attr_reader :api_methods
|
57
|
+
attr_reader :api_methods, :api_version
|
53
58
|
|
54
59
|
##
|
55
60
|
# Look up a SurveyMonkey API method and return its path and associated HTTP method.
|
@@ -67,7 +72,7 @@ class Surveymonkey::API
|
|
67
72
|
$log.debug(sprintf("%s: method '%s'\n", __method__, method))
|
68
73
|
|
69
74
|
# return
|
70
|
-
Surveymonkey::API::Method.new(path, method)
|
75
|
+
Surveymonkey::API::Method.new(path, method, method_name = key)
|
71
76
|
|
72
77
|
rescue KeyError => e
|
73
78
|
$log.error(sprintf("%s: '%s' not found in api methods\n", __method__, key))
|
@@ -107,9 +112,18 @@ class Surveymonkey::API
|
|
107
112
|
def initialize
|
108
113
|
begin
|
109
114
|
@api_methods = Api_methods
|
115
|
+
@api_version = Api_version
|
110
116
|
rescue StandardError => e
|
111
117
|
$log.error(sprintf("%s: %s\n", __method__, e.message))
|
112
118
|
raise
|
113
119
|
end
|
114
120
|
end
|
121
|
+
|
122
|
+
##
|
123
|
+
# Stringify a Surveymonkey::API object.
|
124
|
+
|
125
|
+
def to_s
|
126
|
+
self.api_version
|
127
|
+
end
|
128
|
+
|
115
129
|
end
|
@@ -4,18 +4,21 @@ require 'surveymonkey/logging'
|
|
4
4
|
# Object representing a SurveyMonkey API method.
|
5
5
|
|
6
6
|
class Surveymonkey::API::Method
|
7
|
-
attr_reader :path, :http_method
|
7
|
+
attr_reader :path, :http_method, :method_name
|
8
8
|
|
9
9
|
##
|
10
10
|
# Create a new method. Does some input validation to make sure the
|
11
11
|
# associated HTTP method is valid.
|
12
12
|
|
13
|
-
def initialize(path, http_method = 'post')
|
13
|
+
def initialize(path, http_method = 'post', method_name = 'UNSPECIFIED')
|
14
14
|
begin
|
15
15
|
$log.debug(sprintf("%s: enter", __method__))
|
16
16
|
|
17
17
|
# FIXME validate the path
|
18
|
-
@path = path
|
18
|
+
@path = path.to_s
|
19
|
+
|
20
|
+
# store our short name
|
21
|
+
@method_name = method_name.to_s
|
19
22
|
|
20
23
|
# validate the method
|
21
24
|
$log.debug(sprintf("%s:http_method: '%s'\n", __method__, http_method))
|
@@ -34,4 +37,8 @@ class Surveymonkey::API::Method
|
|
34
37
|
raise
|
35
38
|
end
|
36
39
|
end
|
40
|
+
|
41
|
+
def to_s
|
42
|
+
self.method_name
|
43
|
+
end
|
37
44
|
end
|
data/lib/surveymonkey/client.rb
CHANGED
data/lib/surveymonkey/request.rb
CHANGED
@@ -8,7 +8,7 @@ require 'surveymonkey/client'
|
|
8
8
|
class Surveymonkey::Request
|
9
9
|
|
10
10
|
begin
|
11
|
-
attr_reader :api, :api_method, :client, :path, :api_key, :baseuri
|
11
|
+
attr_reader :api, :api_method, :client, :path, :api_key, :baseuri, :method_name
|
12
12
|
attr_accessor :access_token, :method_params
|
13
13
|
|
14
14
|
# constants
|
@@ -68,6 +68,9 @@ class Surveymonkey::Request
|
|
68
68
|
$log.debug(sprintf("%s: api_method: %s\n", __method__, api_method))
|
69
69
|
$log.debug(sprintf("%s: args: %s\n", __method__, args))
|
70
70
|
|
71
|
+
# store the API method name for stringification
|
72
|
+
@method_name = api_method
|
73
|
+
|
71
74
|
api = Surveymonkey::API.new
|
72
75
|
@api_method = api.api_method(api_method)
|
73
76
|
|
@@ -90,6 +93,15 @@ class Surveymonkey::Request
|
|
90
93
|
end
|
91
94
|
end
|
92
95
|
|
96
|
+
##
|
97
|
+
# Stringify a Surveymonkey::Request object
|
98
|
+
#
|
99
|
+
|
100
|
+
def to_s
|
101
|
+
self.method_name
|
102
|
+
end
|
103
|
+
|
104
|
+
|
93
105
|
# private methods
|
94
106
|
private
|
95
107
|
|
data/lib/surveymonkey/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: surveymonkey
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Steve Huff
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-05-
|
11
|
+
date: 2015-05-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|