survey_monkey_api 0.1.0 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +91 -0
- data/lib/surveymonkey/client/surveys.rb +14 -0
- data/lib/surveymonkey/client/users.rb +12 -0
- data/lib/surveymonkey/client.rb +20 -0
- data/lib/surveymonkey/version.rb +1 -1
- data/lib/surveymonkey.rb +3 -1
- data/surveymonkey.gemspec +1 -0
- metadata +18 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: cc47049a0d0d095e58926273abaf25f5ea4974e6
|
4
|
+
data.tar.gz: 23bffa808dfa822b46f43e16281fecf68f1422cd
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a02e2402277fb4fa14d2256d5fb9e77fe8dd6c38bb9248d325fd1963c800ae8099b55a5e7134617558e8b5cf1767975b7c9c804b8acfb2791d68ffa218158568
|
7
|
+
data.tar.gz: 76950b51efbd75e959d7e9fab8905cc9d80f5eabad8ce408698999e85f2d9a8ff317d1a9f8a6c4d42ed1285876bcdb8fead65a7e345e082edf88178e244b4818
|
data/README.md
CHANGED
@@ -0,0 +1,91 @@
|
|
1
|
+
# SurveyMonkeyApi
|
2
|
+
|
3
|
+
Actions with surveys in SurveyMonkey system.
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'survey_monkey_api'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install survey_monkey_api
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
### Create SurveyMonkeyApi object
|
24
|
+
|
25
|
+
```ruby
|
26
|
+
require 'survey_monkey_api'
|
27
|
+
client = SurveyMonkeyApi::Client.new
|
28
|
+
```
|
29
|
+
|
30
|
+
### User information
|
31
|
+
|
32
|
+
Request for getting user's information is #me.
|
33
|
+
|
34
|
+
```ruby
|
35
|
+
client.me
|
36
|
+
```
|
37
|
+
|
38
|
+
#### Responces
|
39
|
+
|
40
|
+
```ruby
|
41
|
+
{
|
42
|
+
"username"=>"SomeUsername",
|
43
|
+
"scopes"=>{"available"=>["users_read", "surveys_read", "collectors_read", "collectors_write", "contacts_read", "contacts_write", "surveys_write", "responses_read", "responses_read_detail", "responses_write", "groups_read", "webhooks_read", "webhooks_write", "library_read"], "granted"=>["collectors_read", "contacts_write", "contacts_read", "surveys_write", "surveys_read", "collectors_write", "users_read"]},
|
44
|
+
"first_name"=>nil,
|
45
|
+
"last_name"=>nil,
|
46
|
+
"account_type"=>"premier_annual",
|
47
|
+
"language"=>"da",
|
48
|
+
"email_verified"=>false,
|
49
|
+
"email"=>"johndoe@gmail.com",
|
50
|
+
"href"=>"https://api.surveymonkey.net/v3/users/me",
|
51
|
+
"date_last_login"=>"2017-12-21T13:44:01.470000+00:00",
|
52
|
+
"sso_connections"=>[],
|
53
|
+
"date_created"=>"2016-05-11T09:48:00+00:00",
|
54
|
+
"id"=>"00000001"
|
55
|
+
}
|
56
|
+
```
|
57
|
+
|
58
|
+
### Surveys
|
59
|
+
|
60
|
+
Request for getting list of surveys is #surveys.
|
61
|
+
|
62
|
+
```ruby
|
63
|
+
client.surveys
|
64
|
+
```
|
65
|
+
|
66
|
+
#### Responces
|
67
|
+
|
68
|
+
```ruby
|
69
|
+
{
|
70
|
+
"per_page"=>50,
|
71
|
+
"total"=>99,
|
72
|
+
"data"=>[
|
73
|
+
{"href"=>"https://api.surveymonkey.net/v3/surveys/000000001", "nickname"=>"", "id"=>"000000001", "title"=>"First"},
|
74
|
+
{"href"=>"https://api.surveymonkey.net/v3/surveys/000000002", "nickname"=>"", "id"=>"000000002", "title"=>"Second"}
|
75
|
+
],
|
76
|
+
"page"=>1,
|
77
|
+
"links"=>{
|
78
|
+
"self"=>"https://api.surveymonkey.net/v3/surveys?page=1&per_page=50",
|
79
|
+
"last"=>"https://api.surveymonkey.net/v3/surveys?page=2&per_page=50",
|
80
|
+
"next"=>"https://api.surveymonkey.net/v3/surveys?page=2&per_page=50"
|
81
|
+
}
|
82
|
+
}
|
83
|
+
```
|
84
|
+
|
85
|
+
## Contributing
|
86
|
+
|
87
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/kortirso/surveymonkey.
|
88
|
+
|
89
|
+
## License
|
90
|
+
|
91
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module SurveyMonkeyApi
|
2
|
+
class Client
|
3
|
+
# API endpoints for surveys resources
|
4
|
+
module Surveys
|
5
|
+
# Returns list of surveys as array in ['data'] field
|
6
|
+
# Each survey looks like
|
7
|
+
# {"href"=>"https://api.surveymonkey.net/v3/surveys/120053599", "nickname"=>"", "id"=>"120053599", "title"=>"Nyt"}
|
8
|
+
def surveys(options = {})
|
9
|
+
response = self.class.get('/v3/surveys', query: options)
|
10
|
+
response.parsed_response
|
11
|
+
end
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module SurveyMonkeyApi
|
2
|
+
class Client
|
3
|
+
# API endpoints for users resources
|
4
|
+
module Users
|
5
|
+
# Returns current user's information
|
6
|
+
def me(options = {})
|
7
|
+
response = self.class.get('/v3/users/me', query: options)
|
8
|
+
response.parsed_response
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
12
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'httparty'
|
2
|
+
require_relative 'client/users'
|
3
|
+
require_relative 'client/surveys'
|
4
|
+
|
5
|
+
module SurveyMonkeyApi
|
6
|
+
# Client class for api requests
|
7
|
+
class Client
|
8
|
+
include HTTParty
|
9
|
+
include SurveyMonkeyApi::Client::Users
|
10
|
+
include SurveyMonkeyApi::Client::Surveys
|
11
|
+
|
12
|
+
base_uri 'https://api.surveymonkey.net'
|
13
|
+
format :json
|
14
|
+
|
15
|
+
def initialize(_args = {})
|
16
|
+
access_token = ENV['SURVEY_MONKEY_TOKEN']
|
17
|
+
self.class.default_options.merge!(headers: { 'Authorization' => "Bearer #{access_token}", 'Content-Type' => 'application/json' })
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
data/lib/surveymonkey/version.rb
CHANGED
data/lib/surveymonkey.rb
CHANGED
data/surveymonkey.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: survey_monkey_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Anton Bogdanov
|
@@ -66,6 +66,20 @@ dependencies:
|
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: 0.49.1
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: httparty
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0.15'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0.15'
|
69
83
|
description: Actions with surveys in SurveyMonkey system
|
70
84
|
email:
|
71
85
|
- kortirso@gmail.com
|
@@ -85,6 +99,9 @@ files:
|
|
85
99
|
- bin/console
|
86
100
|
- bin/setup
|
87
101
|
- lib/surveymonkey.rb
|
102
|
+
- lib/surveymonkey/client.rb
|
103
|
+
- lib/surveymonkey/client/surveys.rb
|
104
|
+
- lib/surveymonkey/client/users.rb
|
88
105
|
- lib/surveymonkey/version.rb
|
89
106
|
- surveymonkey.gemspec
|
90
107
|
homepage: https://github.com/kortirso/surveymonkey
|