groupme-api 0.6.1 → 0.9.1
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 +5 -5
- data/Gemfile +0 -2
- data/README.md +1 -0
- data/lib/groupme-api.rb +1 -1
- data/lib/groupme.rb +8 -8
- data/lib/groupme/client.rb +11 -12
- data/lib/groupme/configuration.rb +11 -6
- data/lib/groupme/core.rb +13 -0
- data/lib/groupme/image_client.rb +23 -0
- data/lib/groupme/version.rb +1 -1
- data/lib/groupme_api.rb +1 -1
- metadata +70 -43
- data/.gitignore +0 -11
- data/.rspec +0 -3
- data/.rubocop.yml +0 -11
- data/.ruby-version +0 -1
- data/.travis.yml +0 -7
- data/Gemfile.lock +0 -106
- data/Guardfile +0 -8
- data/LICENSE +0 -21
- data/Rakefile +0 -8
- data/groupme-api.gemspec +0 -32
- data/spec/groupme/client_spec.rb +0 -194
- data/spec/groupme/configuration_spec.rb +0 -59
- data/spec/groupme/group_spec.rb +0 -15
- data/spec/groupme_spec.rb +0 -9
- data/spec/spec_helper.rb +0 -17
- data/spec/support/groupme.rb +0 -20
- data/spec/support/vcr.rb +0 -11
- data/spec/support/webmock.rb +0 -5
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: a2a344f14b9cc7eaed4bcb209f2e699930975a3a851eb88818b726c4d2829c06
|
|
4
|
+
data.tar.gz: 680d7f0e7636e8e00f0d6e09184e9df8ee448efbe907a51db340cbfe051a70f8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: b3356af5d8651794947329ad7cb374c69d0952639129c853a2b2ad25c6363e9e52adfc60224d76e5dd0ed78ff39e80d6a238b4c03e5b94f064addf69bb8b4ad0
|
|
7
|
+
data.tar.gz: '01380ffe6fdc3326e2280db7937d7aeca6176279bc85d09ea11ee74540b8696965a8e0451cc809f0c16878fdb1d91653f2ebff6007b7316ce2492905855b6811'
|
data/Gemfile
CHANGED
data/README.md
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# GroupMe Ruby Gem (BETA)
|
|
2
2
|
[](https://travis-ci.org/kinnell/groupme-ruby-gem)
|
|
3
3
|
[](https://coveralls.io/github/kinnell/groupme-ruby-gem?branch=master)
|
|
4
|
+
[](https://snyk.io/test/github/kinnell/groupme-ruby-gem?targetFile=Gemfile.lock)
|
|
4
5
|
|
|
5
6
|
A Ruby wrapper for [GroupMe REST API (v3)](https://dev.groupme.com/docs/v3).
|
|
6
7
|
|
data/lib/groupme-api.rb
CHANGED
data/lib/groupme.rb
CHANGED
|
@@ -2,15 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
require 'httpclient'
|
|
4
4
|
require 'json'
|
|
5
|
+
require 'pathname'
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
require_relative 'groupme/core'
|
|
8
|
+
require_relative 'groupme/client'
|
|
9
|
+
require_relative 'groupme/configuration'
|
|
10
|
+
require_relative 'groupme/errors'
|
|
11
|
+
require_relative 'groupme/group'
|
|
12
|
+
require_relative 'groupme/image_client'
|
|
13
|
+
require_relative 'groupme/version'
|
|
11
14
|
|
|
12
15
|
module GroupMe
|
|
13
|
-
def self.reset!
|
|
14
|
-
@configuration = Configuration.new
|
|
15
|
-
end
|
|
16
16
|
end
|
data/lib/groupme/client.rb
CHANGED
|
@@ -12,11 +12,6 @@ module GroupMe
|
|
|
12
12
|
@client = HTTPClient.new(base_url: API_BASE_URL, default_header: API_DEFAULT_HEADER)
|
|
13
13
|
end
|
|
14
14
|
|
|
15
|
-
def request(method, path, query: {}, body: nil)
|
|
16
|
-
response = @client.request(method, path, { token: @access_token }.merge(query), body&.to_json)
|
|
17
|
-
[parse_response_body(response), response.status]
|
|
18
|
-
end
|
|
19
|
-
|
|
20
15
|
def get(path, query = {})
|
|
21
16
|
request(:get, path, query: query)
|
|
22
17
|
end
|
|
@@ -29,14 +24,18 @@ module GroupMe
|
|
|
29
24
|
request(:delete, path, query: query)
|
|
30
25
|
end
|
|
31
26
|
|
|
27
|
+
def request(method, path, query: {}, body: nil)
|
|
28
|
+
response = @client.request(method, path, { token: @access_token }.merge(query), body&.to_json)
|
|
29
|
+
[parse_response_body(response), response.status]
|
|
30
|
+
end
|
|
31
|
+
|
|
32
32
|
private
|
|
33
33
|
|
|
34
34
|
def parse_response_body(response)
|
|
35
35
|
return response.reason unless response.ok?
|
|
36
|
+
return if blank?(response.body)
|
|
36
37
|
|
|
37
|
-
|
|
38
|
-
JSON.parse(response.body, symbolize_names: true).fetch(:response)
|
|
39
|
-
end
|
|
38
|
+
JSON.parse(response.body, symbolize_names: true).fetch(:response)
|
|
40
39
|
end
|
|
41
40
|
|
|
42
41
|
def blank?(string)
|
|
@@ -44,11 +43,11 @@ module GroupMe
|
|
|
44
43
|
end
|
|
45
44
|
end
|
|
46
45
|
|
|
47
|
-
def self.client
|
|
48
|
-
@client ||= Client.new
|
|
49
|
-
end
|
|
50
|
-
|
|
51
46
|
def self.client=(client)
|
|
52
47
|
@client = client
|
|
53
48
|
end
|
|
49
|
+
|
|
50
|
+
def self.client
|
|
51
|
+
@client ||= Client.new
|
|
52
|
+
end
|
|
54
53
|
end
|
|
@@ -4,7 +4,8 @@ module GroupMe
|
|
|
4
4
|
class Configuration
|
|
5
5
|
API_MAX_GROUPS_PER_PAGE = 500
|
|
6
6
|
|
|
7
|
-
attr_writer :access_token
|
|
7
|
+
attr_writer :access_token
|
|
8
|
+
attr_writer :groups_per_page
|
|
8
9
|
|
|
9
10
|
def access_token
|
|
10
11
|
raise MissingConfigurationError unless @access_token
|
|
@@ -13,19 +14,23 @@ module GroupMe
|
|
|
13
14
|
end
|
|
14
15
|
|
|
15
16
|
def groups_per_page
|
|
16
|
-
@groups_per_page
|
|
17
|
+
@groups_per_page ||= API_MAX_GROUPS_PER_PAGE
|
|
17
18
|
end
|
|
18
19
|
end
|
|
19
20
|
|
|
20
|
-
def self.
|
|
21
|
-
|
|
21
|
+
def self.configure
|
|
22
|
+
yield(configuration)
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def self.reset_configuration!
|
|
26
|
+
@configuration = Configuration.new
|
|
22
27
|
end
|
|
23
28
|
|
|
24
29
|
def self.configuration=(configuration)
|
|
25
30
|
@configuration = configuration
|
|
26
31
|
end
|
|
27
32
|
|
|
28
|
-
def self.
|
|
29
|
-
|
|
33
|
+
def self.configuration
|
|
34
|
+
@configuration ||= Configuration.new
|
|
30
35
|
end
|
|
31
36
|
end
|
data/lib/groupme/core.rb
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module GroupMe
|
|
4
|
+
class ImageClient
|
|
5
|
+
API_BASE_URL = 'https://image.groupme.com/'
|
|
6
|
+
|
|
7
|
+
attr_accessor :access_token
|
|
8
|
+
|
|
9
|
+
def initialize(args = {})
|
|
10
|
+
@access_token = args[:access_token] || GroupMe.configuration.access_token
|
|
11
|
+
@client = HTTPClient.new(base_url: API_BASE_URL, default_header: { 'X-Access-Token': @access_token, 'Content-Type': 'image/jpeg' })
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def upload(image_blob)
|
|
15
|
+
response = @client.post('pictures', image_blob)
|
|
16
|
+
|
|
17
|
+
return response.reason unless response.ok?
|
|
18
|
+
|
|
19
|
+
image = JSON.parse(response.body, symbolize_names: true)
|
|
20
|
+
image[:payload][:url]
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
end
|
data/lib/groupme/version.rb
CHANGED
data/lib/groupme_api.rb
CHANGED
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: groupme-api
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.
|
|
4
|
+
version: 0.9.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Kinnell Shah
|
|
8
|
-
autorequire:
|
|
8
|
+
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2021-05-13 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: httpclient
|
|
@@ -26,18 +26,32 @@ dependencies:
|
|
|
26
26
|
version: '2.8'
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
28
|
name: bundler
|
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
|
30
|
+
requirements:
|
|
31
|
+
- - ">="
|
|
32
|
+
- !ruby/object:Gem::Version
|
|
33
|
+
version: 2.1.0
|
|
34
|
+
type: :development
|
|
35
|
+
prerelease: false
|
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
37
|
+
requirements:
|
|
38
|
+
- - ">="
|
|
39
|
+
- !ruby/object:Gem::Version
|
|
40
|
+
version: 2.1.0
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: byebug
|
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
|
30
44
|
requirements:
|
|
31
45
|
- - "~>"
|
|
32
46
|
- !ruby/object:Gem::Version
|
|
33
|
-
version: '
|
|
47
|
+
version: '11.0'
|
|
34
48
|
type: :development
|
|
35
49
|
prerelease: false
|
|
36
50
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
51
|
requirements:
|
|
38
52
|
- - "~>"
|
|
39
53
|
- !ruby/object:Gem::Version
|
|
40
|
-
version: '
|
|
54
|
+
version: '11.0'
|
|
41
55
|
- !ruby/object:Gem::Dependency
|
|
42
56
|
name: coveralls
|
|
43
57
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -52,6 +66,20 @@ dependencies:
|
|
|
52
66
|
- - "~>"
|
|
53
67
|
- !ruby/object:Gem::Version
|
|
54
68
|
version: '0.8'
|
|
69
|
+
- !ruby/object:Gem::Dependency
|
|
70
|
+
name: guard
|
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
|
72
|
+
requirements:
|
|
73
|
+
- - "~>"
|
|
74
|
+
- !ruby/object:Gem::Version
|
|
75
|
+
version: '2.16'
|
|
76
|
+
type: :development
|
|
77
|
+
prerelease: false
|
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
+
requirements:
|
|
80
|
+
- - "~>"
|
|
81
|
+
- !ruby/object:Gem::Version
|
|
82
|
+
version: '2.16'
|
|
55
83
|
- !ruby/object:Gem::Dependency
|
|
56
84
|
name: guard-rspec
|
|
57
85
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -66,114 +94,114 @@ dependencies:
|
|
|
66
94
|
- - "~>"
|
|
67
95
|
- !ruby/object:Gem::Version
|
|
68
96
|
version: '4.7'
|
|
97
|
+
- !ruby/object:Gem::Dependency
|
|
98
|
+
name: guard-rubocop
|
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
|
100
|
+
requirements:
|
|
101
|
+
- - "~>"
|
|
102
|
+
- !ruby/object:Gem::Version
|
|
103
|
+
version: '1.0'
|
|
104
|
+
type: :development
|
|
105
|
+
prerelease: false
|
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
107
|
+
requirements:
|
|
108
|
+
- - "~>"
|
|
109
|
+
- !ruby/object:Gem::Version
|
|
110
|
+
version: '1.0'
|
|
69
111
|
- !ruby/object:Gem::Dependency
|
|
70
112
|
name: rake
|
|
71
113
|
requirement: !ruby/object:Gem::Requirement
|
|
72
114
|
requirements:
|
|
73
115
|
- - "~>"
|
|
74
116
|
- !ruby/object:Gem::Version
|
|
75
|
-
version: '
|
|
117
|
+
version: '13.0'
|
|
76
118
|
type: :development
|
|
77
119
|
prerelease: false
|
|
78
120
|
version_requirements: !ruby/object:Gem::Requirement
|
|
79
121
|
requirements:
|
|
80
122
|
- - "~>"
|
|
81
123
|
- !ruby/object:Gem::Version
|
|
82
|
-
version: '
|
|
124
|
+
version: '13.0'
|
|
83
125
|
- !ruby/object:Gem::Dependency
|
|
84
126
|
name: rspec
|
|
85
127
|
requirement: !ruby/object:Gem::Requirement
|
|
86
128
|
requirements:
|
|
87
129
|
- - "~>"
|
|
88
130
|
- !ruby/object:Gem::Version
|
|
89
|
-
version: '3.
|
|
131
|
+
version: '3.9'
|
|
90
132
|
type: :development
|
|
91
133
|
prerelease: false
|
|
92
134
|
version_requirements: !ruby/object:Gem::Requirement
|
|
93
135
|
requirements:
|
|
94
136
|
- - "~>"
|
|
95
137
|
- !ruby/object:Gem::Version
|
|
96
|
-
version: '3.
|
|
138
|
+
version: '3.9'
|
|
97
139
|
- !ruby/object:Gem::Dependency
|
|
98
140
|
name: simplecov
|
|
99
141
|
requirement: !ruby/object:Gem::Requirement
|
|
100
142
|
requirements:
|
|
101
143
|
- - "~>"
|
|
102
144
|
- !ruby/object:Gem::Version
|
|
103
|
-
version: '0.
|
|
145
|
+
version: '0.16'
|
|
104
146
|
type: :development
|
|
105
147
|
prerelease: false
|
|
106
148
|
version_requirements: !ruby/object:Gem::Requirement
|
|
107
149
|
requirements:
|
|
108
150
|
- - "~>"
|
|
109
151
|
- !ruby/object:Gem::Version
|
|
110
|
-
version: '0.
|
|
152
|
+
version: '0.16'
|
|
111
153
|
- !ruby/object:Gem::Dependency
|
|
112
154
|
name: vcr
|
|
113
155
|
requirement: !ruby/object:Gem::Requirement
|
|
114
156
|
requirements:
|
|
115
157
|
- - "~>"
|
|
116
158
|
- !ruby/object:Gem::Version
|
|
117
|
-
version: '
|
|
159
|
+
version: '5.0'
|
|
118
160
|
type: :development
|
|
119
161
|
prerelease: false
|
|
120
162
|
version_requirements: !ruby/object:Gem::Requirement
|
|
121
163
|
requirements:
|
|
122
164
|
- - "~>"
|
|
123
165
|
- !ruby/object:Gem::Version
|
|
124
|
-
version: '
|
|
166
|
+
version: '5.0'
|
|
125
167
|
- !ruby/object:Gem::Dependency
|
|
126
168
|
name: webmock
|
|
127
169
|
requirement: !ruby/object:Gem::Requirement
|
|
128
170
|
requirements:
|
|
129
171
|
- - "~>"
|
|
130
172
|
- !ruby/object:Gem::Version
|
|
131
|
-
version: '3.
|
|
173
|
+
version: '3.8'
|
|
132
174
|
type: :development
|
|
133
175
|
prerelease: false
|
|
134
176
|
version_requirements: !ruby/object:Gem::Requirement
|
|
135
177
|
requirements:
|
|
136
178
|
- - "~>"
|
|
137
179
|
- !ruby/object:Gem::Version
|
|
138
|
-
version: '3.
|
|
139
|
-
description:
|
|
140
|
-
email:
|
|
180
|
+
version: '3.8'
|
|
181
|
+
description: A Ruby wrapper for GroupMe REST API (v3)
|
|
182
|
+
email:
|
|
183
|
+
- kinnell@gmail.com
|
|
141
184
|
executables: []
|
|
142
185
|
extensions: []
|
|
143
186
|
extra_rdoc_files: []
|
|
144
187
|
files:
|
|
145
|
-
- ".gitignore"
|
|
146
|
-
- ".rspec"
|
|
147
|
-
- ".rubocop.yml"
|
|
148
|
-
- ".ruby-version"
|
|
149
|
-
- ".travis.yml"
|
|
150
188
|
- Gemfile
|
|
151
|
-
- Gemfile.lock
|
|
152
|
-
- Guardfile
|
|
153
|
-
- LICENSE
|
|
154
189
|
- README.md
|
|
155
|
-
- Rakefile
|
|
156
|
-
- groupme-api.gemspec
|
|
157
190
|
- lib/groupme-api.rb
|
|
158
191
|
- lib/groupme.rb
|
|
159
192
|
- lib/groupme/client.rb
|
|
160
193
|
- lib/groupme/configuration.rb
|
|
194
|
+
- lib/groupme/core.rb
|
|
161
195
|
- lib/groupme/errors.rb
|
|
162
196
|
- lib/groupme/group.rb
|
|
197
|
+
- lib/groupme/image_client.rb
|
|
163
198
|
- lib/groupme/version.rb
|
|
164
199
|
- lib/groupme_api.rb
|
|
165
|
-
- spec/groupme/client_spec.rb
|
|
166
|
-
- spec/groupme/configuration_spec.rb
|
|
167
|
-
- spec/groupme/group_spec.rb
|
|
168
|
-
- spec/groupme_spec.rb
|
|
169
|
-
- spec/spec_helper.rb
|
|
170
|
-
- spec/support/groupme.rb
|
|
171
|
-
- spec/support/vcr.rb
|
|
172
|
-
- spec/support/webmock.rb
|
|
173
200
|
homepage: https://github.com/kinnell/groupme-ruby-gem
|
|
174
|
-
licenses:
|
|
201
|
+
licenses:
|
|
202
|
+
- MIT
|
|
175
203
|
metadata: {}
|
|
176
|
-
post_install_message:
|
|
204
|
+
post_install_message:
|
|
177
205
|
rdoc_options: []
|
|
178
206
|
require_paths:
|
|
179
207
|
- lib
|
|
@@ -181,16 +209,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
181
209
|
requirements:
|
|
182
210
|
- - ">="
|
|
183
211
|
- !ruby/object:Gem::Version
|
|
184
|
-
version: 2.
|
|
212
|
+
version: 2.5.0
|
|
185
213
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
186
214
|
requirements:
|
|
187
215
|
- - ">="
|
|
188
216
|
- !ruby/object:Gem::Version
|
|
189
|
-
version: '0'
|
|
217
|
+
version: '2.0'
|
|
190
218
|
requirements: []
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
signing_key:
|
|
219
|
+
rubygems_version: 3.1.6
|
|
220
|
+
signing_key:
|
|
194
221
|
specification_version: 4
|
|
195
|
-
summary:
|
|
222
|
+
summary: GroupMe
|
|
196
223
|
test_files: []
|
data/.gitignore
DELETED
data/.rspec
DELETED
data/.rubocop.yml
DELETED
data/.ruby-version
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
2.3.0
|
data/.travis.yml
DELETED
data/Gemfile.lock
DELETED
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
PATH
|
|
2
|
-
remote: .
|
|
3
|
-
specs:
|
|
4
|
-
groupme-api (0.6.1)
|
|
5
|
-
httpclient (~> 2.8)
|
|
6
|
-
|
|
7
|
-
GEM
|
|
8
|
-
remote: https://rubygems.org/
|
|
9
|
-
specs:
|
|
10
|
-
addressable (2.5.2)
|
|
11
|
-
public_suffix (>= 2.0.2, < 4.0)
|
|
12
|
-
coderay (1.1.2)
|
|
13
|
-
coveralls (0.8.22)
|
|
14
|
-
json (>= 1.8, < 3)
|
|
15
|
-
simplecov (~> 0.16.1)
|
|
16
|
-
term-ansicolor (~> 1.3)
|
|
17
|
-
thor (~> 0.19.4)
|
|
18
|
-
tins (~> 1.6)
|
|
19
|
-
crack (0.4.3)
|
|
20
|
-
safe_yaml (~> 1.0.0)
|
|
21
|
-
diff-lcs (1.3)
|
|
22
|
-
docile (1.3.1)
|
|
23
|
-
ffi (1.9.25)
|
|
24
|
-
formatador (0.2.5)
|
|
25
|
-
guard (2.14.2)
|
|
26
|
-
formatador (>= 0.2.4)
|
|
27
|
-
listen (>= 2.7, < 4.0)
|
|
28
|
-
lumberjack (>= 1.0.12, < 2.0)
|
|
29
|
-
nenv (~> 0.1)
|
|
30
|
-
notiffany (~> 0.0)
|
|
31
|
-
pry (>= 0.9.12)
|
|
32
|
-
shellany (~> 0.0)
|
|
33
|
-
thor (>= 0.18.1)
|
|
34
|
-
guard-compat (1.2.1)
|
|
35
|
-
guard-rspec (4.7.3)
|
|
36
|
-
guard (~> 2.1)
|
|
37
|
-
guard-compat (~> 1.1)
|
|
38
|
-
rspec (>= 2.99.0, < 4.0)
|
|
39
|
-
hashdiff (0.3.7)
|
|
40
|
-
httpclient (2.8.3)
|
|
41
|
-
json (2.1.0)
|
|
42
|
-
listen (3.1.5)
|
|
43
|
-
rb-fsevent (~> 0.9, >= 0.9.4)
|
|
44
|
-
rb-inotify (~> 0.9, >= 0.9.7)
|
|
45
|
-
ruby_dep (~> 1.2)
|
|
46
|
-
lumberjack (1.0.13)
|
|
47
|
-
method_source (0.9.1)
|
|
48
|
-
nenv (0.3.0)
|
|
49
|
-
notiffany (0.1.1)
|
|
50
|
-
nenv (~> 0.1)
|
|
51
|
-
shellany (~> 0.0)
|
|
52
|
-
pry (0.11.3)
|
|
53
|
-
coderay (~> 1.1.0)
|
|
54
|
-
method_source (~> 0.9.0)
|
|
55
|
-
public_suffix (3.0.3)
|
|
56
|
-
rake (10.5.0)
|
|
57
|
-
rb-fsevent (0.10.3)
|
|
58
|
-
rb-inotify (0.9.10)
|
|
59
|
-
ffi (>= 0.5.0, < 2)
|
|
60
|
-
rspec (3.8.0)
|
|
61
|
-
rspec-core (~> 3.8.0)
|
|
62
|
-
rspec-expectations (~> 3.8.0)
|
|
63
|
-
rspec-mocks (~> 3.8.0)
|
|
64
|
-
rspec-core (3.8.0)
|
|
65
|
-
rspec-support (~> 3.8.0)
|
|
66
|
-
rspec-expectations (3.8.2)
|
|
67
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
|
68
|
-
rspec-support (~> 3.8.0)
|
|
69
|
-
rspec-mocks (3.8.0)
|
|
70
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
|
71
|
-
rspec-support (~> 3.8.0)
|
|
72
|
-
rspec-support (3.8.0)
|
|
73
|
-
ruby_dep (1.5.0)
|
|
74
|
-
safe_yaml (1.0.4)
|
|
75
|
-
shellany (0.0.1)
|
|
76
|
-
simplecov (0.16.1)
|
|
77
|
-
docile (~> 1.1)
|
|
78
|
-
json (>= 1.8, < 3)
|
|
79
|
-
simplecov-html (~> 0.10.0)
|
|
80
|
-
simplecov-html (0.10.2)
|
|
81
|
-
term-ansicolor (1.7.0)
|
|
82
|
-
tins (~> 1.0)
|
|
83
|
-
thor (0.19.4)
|
|
84
|
-
tins (1.18.0)
|
|
85
|
-
vcr (4.0.0)
|
|
86
|
-
webmock (3.4.2)
|
|
87
|
-
addressable (>= 2.3.6)
|
|
88
|
-
crack (>= 0.3.2)
|
|
89
|
-
hashdiff
|
|
90
|
-
|
|
91
|
-
PLATFORMS
|
|
92
|
-
ruby
|
|
93
|
-
|
|
94
|
-
DEPENDENCIES
|
|
95
|
-
bundler (~> 1.16)
|
|
96
|
-
coveralls (~> 0.8)
|
|
97
|
-
groupme-api!
|
|
98
|
-
guard-rspec (~> 4.7)
|
|
99
|
-
rake (~> 10.0)
|
|
100
|
-
rspec (~> 3.8)
|
|
101
|
-
simplecov (~> 0.15)
|
|
102
|
-
vcr (~> 4.0)
|
|
103
|
-
webmock (~> 3.4)
|
|
104
|
-
|
|
105
|
-
BUNDLED WITH
|
|
106
|
-
1.16.3
|
data/Guardfile
DELETED
data/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2018 Kinnell Shah
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
data/Rakefile
DELETED
data/groupme-api.gemspec
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
lib = File.expand_path('lib', __dir__)
|
|
4
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
|
5
|
-
|
|
6
|
-
require 'groupme/version'
|
|
7
|
-
|
|
8
|
-
Gem::Specification.new do |spec|
|
|
9
|
-
spec.platform = Gem::Platform::RUBY
|
|
10
|
-
spec.name = 'groupme-api'
|
|
11
|
-
spec.version = GroupMe::VERSION
|
|
12
|
-
spec.summary = 'A Ruby wrapper for GroupMe REST API (v3)'
|
|
13
|
-
|
|
14
|
-
spec.author = 'Kinnell Shah'
|
|
15
|
-
spec.email = 'kinnell@gmail.com'
|
|
16
|
-
spec.homepage = 'https://github.com/kinnell/groupme-ruby-gem'
|
|
17
|
-
|
|
18
|
-
spec.files = `git ls-files`.split("\n")
|
|
19
|
-
spec.require_path = 'lib'
|
|
20
|
-
spec.required_ruby_version = Gem::Requirement.new('>= 2.3.0')
|
|
21
|
-
|
|
22
|
-
spec.add_dependency 'httpclient', '~> 2.8'
|
|
23
|
-
|
|
24
|
-
spec.add_development_dependency 'bundler', '~> 1.16'
|
|
25
|
-
spec.add_development_dependency 'coveralls', '~> 0.8'
|
|
26
|
-
spec.add_development_dependency 'guard-rspec', '~> 4.7'
|
|
27
|
-
spec.add_development_dependency 'rake', '~> 10.0'
|
|
28
|
-
spec.add_development_dependency 'rspec', '~> 3.8'
|
|
29
|
-
spec.add_development_dependency 'simplecov', '~> 0.15'
|
|
30
|
-
spec.add_development_dependency 'vcr', '~> 4.0'
|
|
31
|
-
spec.add_development_dependency 'webmock', '~> 3.4'
|
|
32
|
-
end
|
data/spec/groupme/client_spec.rb
DELETED
|
@@ -1,194 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
RSpec.describe GroupMe::Client do
|
|
4
|
-
include_context :with_default_groupme_configuration
|
|
5
|
-
|
|
6
|
-
let(:client) { GroupMe::Client.new(access_token: access_token) }
|
|
7
|
-
let(:base_url) { GroupMe::Client::API_BASE_URL }
|
|
8
|
-
|
|
9
|
-
describe '.new' do
|
|
10
|
-
context 'when :access_token is not supplied' do
|
|
11
|
-
let(:client) { GroupMe::Client.new }
|
|
12
|
-
|
|
13
|
-
it 'should use configured :access_token' do
|
|
14
|
-
expect(client.access_token).to eq(GroupMe.configuration.access_token)
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
context 'when :access_token is supplied' do
|
|
19
|
-
let(:client) { GroupMe::Client.new(access_token: new_access_token) }
|
|
20
|
-
|
|
21
|
-
it 'should not use configured :access_token' do
|
|
22
|
-
expect(client.access_token).not_to eq(GroupMe.configuration.access_token)
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
it 'should use the supplied :access_token' do
|
|
26
|
-
expect(client.access_token).to eq(new_access_token)
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
describe '#request' do
|
|
32
|
-
let(:stubbed_data) { { id: 1, name: 'Group' } }
|
|
33
|
-
let(:stubbed_response_body) { { response: stubbed_data }.to_json }
|
|
34
|
-
let(:stubbed_response_status) { 200 }
|
|
35
|
-
|
|
36
|
-
before do
|
|
37
|
-
stub_request(:any, /api.groupme.com/).to_return(
|
|
38
|
-
body: stubbed_response_body,
|
|
39
|
-
status: stubbed_response_status
|
|
40
|
-
)
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
context 'when no parameters are supplied' do
|
|
44
|
-
it 'should send the correct HTTP request' do
|
|
45
|
-
client.request(:get, 'groups')
|
|
46
|
-
|
|
47
|
-
expect(WebMock).to have_requested(:get, "#{base_url}groups").with(query: { token: access_token })
|
|
48
|
-
end
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
context 'when query parameters are supplied' do
|
|
52
|
-
it 'should send the correct HTTP request' do
|
|
53
|
-
client.request(:get, 'groups', query: { per_page: 1 })
|
|
54
|
-
|
|
55
|
-
expect(WebMock).to have_requested(:get, "#{base_url}groups").with(query: { token: access_token, per_page: 1 })
|
|
56
|
-
end
|
|
57
|
-
end
|
|
58
|
-
|
|
59
|
-
context 'when body parameters are supplied' do
|
|
60
|
-
it 'should send the correct HTTP request' do
|
|
61
|
-
client.request(:post, 'groups', body: { name: 'Group' })
|
|
62
|
-
|
|
63
|
-
expect(WebMock).to have_requested(:post, "#{base_url}groups?token=#{access_token}").with(body: { name: 'Group' }.to_json)
|
|
64
|
-
end
|
|
65
|
-
end
|
|
66
|
-
|
|
67
|
-
context 'when the response is successful' do
|
|
68
|
-
let(:stubbed_response_body) { { response: stubbed_data }.to_json }
|
|
69
|
-
let(:stubbed_response_status) { 201 }
|
|
70
|
-
|
|
71
|
-
it 'should parse and return the response' do
|
|
72
|
-
response, _status = client.request(:post, 'groups')
|
|
73
|
-
|
|
74
|
-
expect(response).to eq(stubbed_data)
|
|
75
|
-
end
|
|
76
|
-
|
|
77
|
-
it 'should return the successful status code' do
|
|
78
|
-
_response, status = client.request(:post, 'groups')
|
|
79
|
-
|
|
80
|
-
expect(status).to eq(201)
|
|
81
|
-
end
|
|
82
|
-
end
|
|
83
|
-
|
|
84
|
-
context 'when the response is unsuccessful' do
|
|
85
|
-
let(:stubbed_response_body) { '' }
|
|
86
|
-
let(:stubbed_response_status) { [404, 'Not Found'] }
|
|
87
|
-
|
|
88
|
-
it 'should return the response reason' do
|
|
89
|
-
response, _status = client.request(:post, 'groups')
|
|
90
|
-
|
|
91
|
-
expect(response).to eq('Not Found')
|
|
92
|
-
end
|
|
93
|
-
|
|
94
|
-
it 'should return the unsuccesful status code' do
|
|
95
|
-
_response, status = client.request(:post, 'groups')
|
|
96
|
-
|
|
97
|
-
expect(status).to eq(404)
|
|
98
|
-
end
|
|
99
|
-
end
|
|
100
|
-
end
|
|
101
|
-
|
|
102
|
-
describe '#get' do
|
|
103
|
-
let(:stubbed_data) { { id: 1, name: 'Group' } }
|
|
104
|
-
let(:stubbed_response_code) { 200 }
|
|
105
|
-
|
|
106
|
-
before do
|
|
107
|
-
stub_request(:get, /api.groupme.com/).to_return(
|
|
108
|
-
body: { response: stubbed_data }.to_json,
|
|
109
|
-
status: stubbed_response_code
|
|
110
|
-
)
|
|
111
|
-
end
|
|
112
|
-
|
|
113
|
-
it 'should parse and return the response' do
|
|
114
|
-
response, _status = client.get('groups', per_page: 1)
|
|
115
|
-
|
|
116
|
-
expect(response).to eq(stubbed_data)
|
|
117
|
-
end
|
|
118
|
-
|
|
119
|
-
it 'should return the status code' do
|
|
120
|
-
_response, status = client.get('groups', per_page: 1)
|
|
121
|
-
|
|
122
|
-
expect(status).to eq(stubbed_response_code)
|
|
123
|
-
end
|
|
124
|
-
end
|
|
125
|
-
|
|
126
|
-
describe '#post' do
|
|
127
|
-
let(:stubbed_data) { { id: 1, name: 'Group' } }
|
|
128
|
-
let(:stubbed_response_code) { 200 }
|
|
129
|
-
|
|
130
|
-
before do
|
|
131
|
-
stub_request(:post, /api.groupme.com/).to_return(
|
|
132
|
-
body: { response: stubbed_data }.to_json,
|
|
133
|
-
status: stubbed_response_code
|
|
134
|
-
)
|
|
135
|
-
end
|
|
136
|
-
|
|
137
|
-
it 'should parse and return the response' do
|
|
138
|
-
response, _status = client.post('groups', name: 'Group')
|
|
139
|
-
|
|
140
|
-
expect(response).to eq(stubbed_data)
|
|
141
|
-
end
|
|
142
|
-
|
|
143
|
-
it 'should return the status code' do
|
|
144
|
-
_response, status = client.post('groups', name: 'Group')
|
|
145
|
-
|
|
146
|
-
expect(status).to eq(stubbed_response_code)
|
|
147
|
-
end
|
|
148
|
-
end
|
|
149
|
-
|
|
150
|
-
describe '#delete' do
|
|
151
|
-
let(:stubbed_data) { 'OK' }
|
|
152
|
-
let(:stubbed_response_code) { 200 }
|
|
153
|
-
|
|
154
|
-
before do
|
|
155
|
-
stub_request(:delete, /api.groupme.com/).to_return(
|
|
156
|
-
body: { response: stubbed_data }.to_json,
|
|
157
|
-
status: stubbed_response_code
|
|
158
|
-
)
|
|
159
|
-
end
|
|
160
|
-
|
|
161
|
-
it 'should parse and return the response' do
|
|
162
|
-
response, _status = client.delete('groups', id: 1)
|
|
163
|
-
|
|
164
|
-
expect(response).to eq(stubbed_data)
|
|
165
|
-
end
|
|
166
|
-
|
|
167
|
-
it 'should return the status code' do
|
|
168
|
-
_response, status = client.delete('groups', id: 1)
|
|
169
|
-
|
|
170
|
-
expect(status).to eq(stubbed_response_code)
|
|
171
|
-
end
|
|
172
|
-
end
|
|
173
|
-
end
|
|
174
|
-
|
|
175
|
-
RSpec.describe GroupMe do
|
|
176
|
-
include_context :with_default_groupme_configuration
|
|
177
|
-
|
|
178
|
-
describe '.client' do
|
|
179
|
-
it 'should return a GroupMe::Client object' do
|
|
180
|
-
expect(GroupMe.client).to be_a_instance_of(GroupMe::Client)
|
|
181
|
-
end
|
|
182
|
-
end
|
|
183
|
-
|
|
184
|
-
describe '.client=' do
|
|
185
|
-
it 'should set a new default client' do
|
|
186
|
-
old_client = GroupMe.client
|
|
187
|
-
new_client = GroupMe::Client.new
|
|
188
|
-
GroupMe.client = new_client
|
|
189
|
-
|
|
190
|
-
expect(GroupMe.client).not_to eq(old_client)
|
|
191
|
-
expect(GroupMe.client).to eq(new_client)
|
|
192
|
-
end
|
|
193
|
-
end
|
|
194
|
-
end
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'spec_helper'
|
|
4
|
-
|
|
5
|
-
RSpec.describe GroupMe::Configuration do
|
|
6
|
-
before(:each) { GroupMe.reset! }
|
|
7
|
-
|
|
8
|
-
describe '#access_token' do
|
|
9
|
-
context 'when :access_token is not configured' do
|
|
10
|
-
it 'should raise an error' do
|
|
11
|
-
expect { GroupMe.configuration.access_token }.to raise_error(GroupMe::MissingConfigurationError)
|
|
12
|
-
end
|
|
13
|
-
end
|
|
14
|
-
|
|
15
|
-
context 'when :access_token is configured' do
|
|
16
|
-
include_context :with_default_groupme_configuration
|
|
17
|
-
|
|
18
|
-
it 'should return the access_token' do
|
|
19
|
-
expect(GroupMe.configuration.access_token).to eq(access_token)
|
|
20
|
-
end
|
|
21
|
-
end
|
|
22
|
-
end
|
|
23
|
-
end
|
|
24
|
-
|
|
25
|
-
RSpec.describe GroupMe do
|
|
26
|
-
describe '.configuration' do
|
|
27
|
-
it 'should return a GroupMe::Configuration object' do
|
|
28
|
-
expect(GroupMe.configuration).to be_an_instance_of(GroupMe::Configuration)
|
|
29
|
-
end
|
|
30
|
-
end
|
|
31
|
-
|
|
32
|
-
describe '.configuration=' do
|
|
33
|
-
it 'should set a new default configuration' do
|
|
34
|
-
old_configuration = GroupMe.configuration
|
|
35
|
-
new_configuration = GroupMe::Configuration.new
|
|
36
|
-
GroupMe.configuration = new_configuration
|
|
37
|
-
|
|
38
|
-
expect(GroupMe.configuration).not_to eq(old_configuration)
|
|
39
|
-
expect(GroupMe.configuration).to eq(new_configuration)
|
|
40
|
-
end
|
|
41
|
-
end
|
|
42
|
-
|
|
43
|
-
describe 'configure' do
|
|
44
|
-
it 'should set configuration attributes' do
|
|
45
|
-
GroupMe.configure { |config| config.access_token = access_token }
|
|
46
|
-
|
|
47
|
-
expect(GroupMe.configuration.access_token).to eq(access_token)
|
|
48
|
-
end
|
|
49
|
-
end
|
|
50
|
-
|
|
51
|
-
describe 'reset!' do
|
|
52
|
-
it 'should reset the configuration' do
|
|
53
|
-
old_configuration = GroupMe.configuration
|
|
54
|
-
GroupMe.reset!
|
|
55
|
-
|
|
56
|
-
expect(GroupMe.configuration).not_to eq(old_configuration)
|
|
57
|
-
end
|
|
58
|
-
end
|
|
59
|
-
end
|
data/spec/groupme/group_spec.rb
DELETED
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
RSpec.describe GroupMe::Group do
|
|
4
|
-
include_context :with_default_groupme_configuration
|
|
5
|
-
|
|
6
|
-
let(:base_url) { GroupMe::Client::API_BASE_URL }
|
|
7
|
-
|
|
8
|
-
describe '#all' do
|
|
9
|
-
it 'should send the correct HTTP request' do
|
|
10
|
-
_groups = GroupMe::Group.all
|
|
11
|
-
|
|
12
|
-
expect(WebMock).to have_requested(:get, "#{base_url}groups").with(query: { token: access_token, omit: :memberships, per_page: GroupMe.configuration.groups_per_page })
|
|
13
|
-
end
|
|
14
|
-
end
|
|
15
|
-
end
|
data/spec/groupme_spec.rb
DELETED
data/spec/spec_helper.rb
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'simplecov'
|
|
4
|
-
require 'coveralls'
|
|
5
|
-
|
|
6
|
-
SimpleCov.start
|
|
7
|
-
Coveralls.wear!
|
|
8
|
-
|
|
9
|
-
require 'groupme'
|
|
10
|
-
|
|
11
|
-
require 'support/groupme'
|
|
12
|
-
require 'support/vcr'
|
|
13
|
-
require 'support/webmock'
|
|
14
|
-
|
|
15
|
-
RSpec.configure do |config|
|
|
16
|
-
config.filter_run_when_matching :focus
|
|
17
|
-
end
|
data/spec/support/groupme.rb
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'securerandom'
|
|
4
|
-
|
|
5
|
-
RSpec.shared_context :with_defined_access_token do
|
|
6
|
-
let(:access_token) { 'cQOvtsbxn7mHCS6yRimKuKHwXCGtqRwcU4E4NToe' }
|
|
7
|
-
let(:new_access_token) { SecureRandom.base64(30).tr('+', '0') }
|
|
8
|
-
end
|
|
9
|
-
|
|
10
|
-
RSpec.shared_context :with_default_groupme_configuration do
|
|
11
|
-
before(:each) do
|
|
12
|
-
GroupMe.configure do |config|
|
|
13
|
-
config.access_token = 'cQOvtsbxn7mHCS6yRimKuKHwXCGtqRwcU4E4NToe'
|
|
14
|
-
end
|
|
15
|
-
end
|
|
16
|
-
end
|
|
17
|
-
|
|
18
|
-
RSpec.configure do |config|
|
|
19
|
-
config.include_context :with_defined_access_token
|
|
20
|
-
end
|
data/spec/support/vcr.rb
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
require 'vcr'
|
|
4
|
-
|
|
5
|
-
VCR.configure do |config|
|
|
6
|
-
config.hook_into :webmock
|
|
7
|
-
config.allow_http_connections_when_no_cassette = true
|
|
8
|
-
config.cassette_library_dir = 'spec/fixtures'
|
|
9
|
-
config.default_cassette_options = { record: :new_episodes }
|
|
10
|
-
config.filter_sensitive_data('ACCESS_TOKEN') { ACCESS_TOKEN }
|
|
11
|
-
end
|