groupme-api 0.7.1 → 0.9.3
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/client.rb +11 -12
- data/lib/groupme/configuration.rb +9 -5
- data/lib/groupme/core.rb +11 -0
- data/lib/groupme/version.rb +1 -1
- data/lib/groupme-api.rb +1 -1
- data/lib/groupme.rb +8 -9
- data/lib/groupme_api.rb +1 -1
- metadata +78 -40
- 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 -104
- data/Guardfile +0 -8
- data/LICENSE +0 -21
- data/Rakefile +0 -8
- data/groupme-api.gemspec +0 -33
- data/spec/groupme/client_spec.rb +0 -194
- data/spec/groupme/configuration_spec.rb +0 -59
- data/spec/groupme/group_spec.rb +0 -13
- data/spec/groupme/image_client_spec.rb +0 -16
- 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: 1a0a40683e4f25c0d66f4865ee278e1e2570651e21cb324d71cec48d033fbe0f
|
|
4
|
+
data.tar.gz: 4a321e8fae697f8197f7bc7130dcec6db6ea8175568da760b6f42c99368e5ab1
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 22b6310c48cd75a4e2e594691bcb9d61538bd42cc02726636faa488478ed77759f30dc7e18ffd3c5dd6c242d1b2c409a47730d340e00a1dfa08799025ca8a3cf
|
|
7
|
+
data.tar.gz: f17b39de844117a203df4ea0c318ef431b37f4fa3d55a5c22505d1a5eb5de00277380f3f64a88b04630c4ae34d163cb260a0776757f01fe0b7216ca53cde1882
|
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/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
|
|
@@ -13,19 +13,23 @@ module GroupMe
|
|
|
13
13
|
end
|
|
14
14
|
|
|
15
15
|
def groups_per_page
|
|
16
|
-
@groups_per_page
|
|
16
|
+
@groups_per_page ||= API_MAX_GROUPS_PER_PAGE
|
|
17
17
|
end
|
|
18
18
|
end
|
|
19
19
|
|
|
20
|
-
def self.
|
|
21
|
-
|
|
20
|
+
def self.configure
|
|
21
|
+
yield(configuration)
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
def self.reset_configuration!
|
|
25
|
+
@configuration = Configuration.new
|
|
22
26
|
end
|
|
23
27
|
|
|
24
28
|
def self.configuration=(configuration)
|
|
25
29
|
@configuration = configuration
|
|
26
30
|
end
|
|
27
31
|
|
|
28
|
-
def self.
|
|
29
|
-
|
|
32
|
+
def self.configuration
|
|
33
|
+
@configuration ||= Configuration.new
|
|
30
34
|
end
|
|
31
35
|
end
|
data/lib/groupme/core.rb
ADDED
data/lib/groupme/version.rb
CHANGED
data/lib/groupme-api.rb
CHANGED
data/lib/groupme.rb
CHANGED
|
@@ -2,16 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
require 'httpclient'
|
|
4
4
|
require 'json'
|
|
5
|
+
require 'pathname'
|
|
5
6
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
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'
|
|
12
14
|
|
|
13
15
|
module GroupMe
|
|
14
|
-
def self.reset!
|
|
15
|
-
@configuration = Configuration.new
|
|
16
|
-
end
|
|
17
16
|
end
|
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.3
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Kinnell Shah
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2021-11-22 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: httpclient
|
|
@@ -30,14 +30,28 @@ dependencies:
|
|
|
30
30
|
requirements:
|
|
31
31
|
- - "~>"
|
|
32
32
|
- !ruby/object:Gem::Version
|
|
33
|
-
version: '1
|
|
33
|
+
version: '2.1'
|
|
34
34
|
type: :development
|
|
35
35
|
prerelease: false
|
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
|
37
37
|
requirements:
|
|
38
38
|
- - "~>"
|
|
39
39
|
- !ruby/object:Gem::Version
|
|
40
|
-
version: '1
|
|
40
|
+
version: '2.1'
|
|
41
|
+
- !ruby/object:Gem::Dependency
|
|
42
|
+
name: byebug
|
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
|
44
|
+
requirements:
|
|
45
|
+
- - "~>"
|
|
46
|
+
- !ruby/object:Gem::Version
|
|
47
|
+
version: '11.0'
|
|
48
|
+
type: :development
|
|
49
|
+
prerelease: false
|
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
51
|
+
requirements:
|
|
52
|
+
- - "~>"
|
|
53
|
+
- !ruby/object:Gem::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,34 @@ dependencies:
|
|
|
52
66
|
- - "~>"
|
|
53
67
|
- !ruby/object:Gem::Version
|
|
54
68
|
version: '0.8'
|
|
69
|
+
- !ruby/object:Gem::Dependency
|
|
70
|
+
name: gem-release
|
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
|
72
|
+
requirements:
|
|
73
|
+
- - "~>"
|
|
74
|
+
- !ruby/object:Gem::Version
|
|
75
|
+
version: '2.2'
|
|
76
|
+
type: :development
|
|
77
|
+
prerelease: false
|
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
79
|
+
requirements:
|
|
80
|
+
- - "~>"
|
|
81
|
+
- !ruby/object:Gem::Version
|
|
82
|
+
version: '2.2'
|
|
83
|
+
- !ruby/object:Gem::Dependency
|
|
84
|
+
name: guard
|
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
|
86
|
+
requirements:
|
|
87
|
+
- - "~>"
|
|
88
|
+
- !ruby/object:Gem::Version
|
|
89
|
+
version: '2.16'
|
|
90
|
+
type: :development
|
|
91
|
+
prerelease: false
|
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
93
|
+
requirements:
|
|
94
|
+
- - "~>"
|
|
95
|
+
- !ruby/object:Gem::Version
|
|
96
|
+
version: '2.16'
|
|
55
97
|
- !ruby/object:Gem::Dependency
|
|
56
98
|
name: guard-rspec
|
|
57
99
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -66,112 +108,109 @@ dependencies:
|
|
|
66
108
|
- - "~>"
|
|
67
109
|
- !ruby/object:Gem::Version
|
|
68
110
|
version: '4.7'
|
|
111
|
+
- !ruby/object:Gem::Dependency
|
|
112
|
+
name: guard-rubocop
|
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
|
114
|
+
requirements:
|
|
115
|
+
- - "~>"
|
|
116
|
+
- !ruby/object:Gem::Version
|
|
117
|
+
version: '1.0'
|
|
118
|
+
type: :development
|
|
119
|
+
prerelease: false
|
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
|
121
|
+
requirements:
|
|
122
|
+
- - "~>"
|
|
123
|
+
- !ruby/object:Gem::Version
|
|
124
|
+
version: '1.0'
|
|
69
125
|
- !ruby/object:Gem::Dependency
|
|
70
126
|
name: rake
|
|
71
127
|
requirement: !ruby/object:Gem::Requirement
|
|
72
128
|
requirements:
|
|
73
129
|
- - "~>"
|
|
74
130
|
- !ruby/object:Gem::Version
|
|
75
|
-
version: '
|
|
131
|
+
version: '13.0'
|
|
76
132
|
type: :development
|
|
77
133
|
prerelease: false
|
|
78
134
|
version_requirements: !ruby/object:Gem::Requirement
|
|
79
135
|
requirements:
|
|
80
136
|
- - "~>"
|
|
81
137
|
- !ruby/object:Gem::Version
|
|
82
|
-
version: '
|
|
138
|
+
version: '13.0'
|
|
83
139
|
- !ruby/object:Gem::Dependency
|
|
84
140
|
name: rspec
|
|
85
141
|
requirement: !ruby/object:Gem::Requirement
|
|
86
142
|
requirements:
|
|
87
143
|
- - "~>"
|
|
88
144
|
- !ruby/object:Gem::Version
|
|
89
|
-
version: '3.
|
|
145
|
+
version: '3.9'
|
|
90
146
|
type: :development
|
|
91
147
|
prerelease: false
|
|
92
148
|
version_requirements: !ruby/object:Gem::Requirement
|
|
93
149
|
requirements:
|
|
94
150
|
- - "~>"
|
|
95
151
|
- !ruby/object:Gem::Version
|
|
96
|
-
version: '3.
|
|
152
|
+
version: '3.9'
|
|
97
153
|
- !ruby/object:Gem::Dependency
|
|
98
154
|
name: simplecov
|
|
99
155
|
requirement: !ruby/object:Gem::Requirement
|
|
100
156
|
requirements:
|
|
101
157
|
- - "~>"
|
|
102
158
|
- !ruby/object:Gem::Version
|
|
103
|
-
version: '0.
|
|
159
|
+
version: '0.16'
|
|
104
160
|
type: :development
|
|
105
161
|
prerelease: false
|
|
106
162
|
version_requirements: !ruby/object:Gem::Requirement
|
|
107
163
|
requirements:
|
|
108
164
|
- - "~>"
|
|
109
165
|
- !ruby/object:Gem::Version
|
|
110
|
-
version: '0.
|
|
166
|
+
version: '0.16'
|
|
111
167
|
- !ruby/object:Gem::Dependency
|
|
112
168
|
name: vcr
|
|
113
169
|
requirement: !ruby/object:Gem::Requirement
|
|
114
170
|
requirements:
|
|
115
171
|
- - "~>"
|
|
116
172
|
- !ruby/object:Gem::Version
|
|
117
|
-
version: '
|
|
173
|
+
version: '5.0'
|
|
118
174
|
type: :development
|
|
119
175
|
prerelease: false
|
|
120
176
|
version_requirements: !ruby/object:Gem::Requirement
|
|
121
177
|
requirements:
|
|
122
178
|
- - "~>"
|
|
123
179
|
- !ruby/object:Gem::Version
|
|
124
|
-
version: '
|
|
180
|
+
version: '5.0'
|
|
125
181
|
- !ruby/object:Gem::Dependency
|
|
126
182
|
name: webmock
|
|
127
183
|
requirement: !ruby/object:Gem::Requirement
|
|
128
184
|
requirements:
|
|
129
185
|
- - "~>"
|
|
130
186
|
- !ruby/object:Gem::Version
|
|
131
|
-
version: '3.
|
|
187
|
+
version: '3.8'
|
|
132
188
|
type: :development
|
|
133
189
|
prerelease: false
|
|
134
190
|
version_requirements: !ruby/object:Gem::Requirement
|
|
135
191
|
requirements:
|
|
136
192
|
- - "~>"
|
|
137
193
|
- !ruby/object:Gem::Version
|
|
138
|
-
version: '3.
|
|
139
|
-
description:
|
|
140
|
-
email:
|
|
194
|
+
version: '3.8'
|
|
195
|
+
description: A Ruby wrapper for GroupMe REST API (v3)
|
|
196
|
+
email:
|
|
197
|
+
- kinnell@gmail.com
|
|
141
198
|
executables: []
|
|
142
199
|
extensions: []
|
|
143
200
|
extra_rdoc_files: []
|
|
144
201
|
files:
|
|
145
|
-
- ".gitignore"
|
|
146
|
-
- ".rspec"
|
|
147
|
-
- ".rubocop.yml"
|
|
148
|
-
- ".ruby-version"
|
|
149
|
-
- ".travis.yml"
|
|
150
202
|
- Gemfile
|
|
151
|
-
- Gemfile.lock
|
|
152
|
-
- Guardfile
|
|
153
|
-
- LICENSE
|
|
154
203
|
- README.md
|
|
155
|
-
- Rakefile
|
|
156
|
-
- groupme-api.gemspec
|
|
157
204
|
- lib/groupme-api.rb
|
|
158
205
|
- lib/groupme.rb
|
|
159
206
|
- lib/groupme/client.rb
|
|
160
207
|
- lib/groupme/configuration.rb
|
|
208
|
+
- lib/groupme/core.rb
|
|
161
209
|
- lib/groupme/errors.rb
|
|
162
210
|
- lib/groupme/group.rb
|
|
163
211
|
- lib/groupme/image_client.rb
|
|
164
212
|
- lib/groupme/version.rb
|
|
165
213
|
- lib/groupme_api.rb
|
|
166
|
-
- spec/groupme/client_spec.rb
|
|
167
|
-
- spec/groupme/configuration_spec.rb
|
|
168
|
-
- spec/groupme/group_spec.rb
|
|
169
|
-
- spec/groupme/image_client_spec.rb
|
|
170
|
-
- spec/groupme_spec.rb
|
|
171
|
-
- spec/spec_helper.rb
|
|
172
|
-
- spec/support/groupme.rb
|
|
173
|
-
- spec/support/vcr.rb
|
|
174
|
-
- spec/support/webmock.rb
|
|
175
214
|
homepage: https://github.com/kinnell/groupme-ruby-gem
|
|
176
215
|
licenses:
|
|
177
216
|
- MIT
|
|
@@ -184,16 +223,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
|
184
223
|
requirements:
|
|
185
224
|
- - ">="
|
|
186
225
|
- !ruby/object:Gem::Version
|
|
187
|
-
version: 2.
|
|
226
|
+
version: 2.5.0
|
|
188
227
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
|
189
228
|
requirements:
|
|
190
229
|
- - ">="
|
|
191
230
|
- !ruby/object:Gem::Version
|
|
192
|
-
version: '0'
|
|
231
|
+
version: '2.0'
|
|
193
232
|
requirements: []
|
|
194
|
-
|
|
195
|
-
rubygems_version: 2.5.1
|
|
233
|
+
rubygems_version: 3.1.6
|
|
196
234
|
signing_key:
|
|
197
235
|
specification_version: 4
|
|
198
|
-
summary:
|
|
236
|
+
summary: GroupMe
|
|
199
237
|
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,104 +0,0 @@
|
|
|
1
|
-
PATH
|
|
2
|
-
remote: .
|
|
3
|
-
specs:
|
|
4
|
-
groupme-api (0.7.1)
|
|
5
|
-
httpclient (~> 2.8)
|
|
6
|
-
|
|
7
|
-
GEM
|
|
8
|
-
remote: https://rubygems.org/
|
|
9
|
-
specs:
|
|
10
|
-
addressable (2.7.0)
|
|
11
|
-
public_suffix (>= 2.0.2, < 5.0)
|
|
12
|
-
coderay (1.1.2)
|
|
13
|
-
coveralls (0.8.23)
|
|
14
|
-
json (>= 1.8, < 3)
|
|
15
|
-
simplecov (~> 0.16.1)
|
|
16
|
-
term-ansicolor (~> 1.3)
|
|
17
|
-
thor (>= 0.19.4, < 2.0)
|
|
18
|
-
tins (~> 1.6)
|
|
19
|
-
crack (0.4.3)
|
|
20
|
-
safe_yaml (~> 1.0.0)
|
|
21
|
-
diff-lcs (1.3)
|
|
22
|
-
docile (1.3.2)
|
|
23
|
-
ffi (1.11.1)
|
|
24
|
-
formatador (0.2.5)
|
|
25
|
-
guard (2.15.1)
|
|
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 (1.0.0)
|
|
40
|
-
httpclient (2.8.3)
|
|
41
|
-
json (2.2.0)
|
|
42
|
-
listen (3.2.0)
|
|
43
|
-
rb-fsevent (~> 0.10, >= 0.10.3)
|
|
44
|
-
rb-inotify (~> 0.9, >= 0.9.10)
|
|
45
|
-
lumberjack (1.0.13)
|
|
46
|
-
method_source (0.9.2)
|
|
47
|
-
nenv (0.3.0)
|
|
48
|
-
notiffany (0.1.3)
|
|
49
|
-
nenv (~> 0.1)
|
|
50
|
-
shellany (~> 0.0)
|
|
51
|
-
pry (0.12.2)
|
|
52
|
-
coderay (~> 1.1.0)
|
|
53
|
-
method_source (~> 0.9.0)
|
|
54
|
-
public_suffix (4.0.1)
|
|
55
|
-
rake (10.5.0)
|
|
56
|
-
rb-fsevent (0.10.3)
|
|
57
|
-
rb-inotify (0.10.0)
|
|
58
|
-
ffi (~> 1.0)
|
|
59
|
-
rspec (3.9.0)
|
|
60
|
-
rspec-core (~> 3.9.0)
|
|
61
|
-
rspec-expectations (~> 3.9.0)
|
|
62
|
-
rspec-mocks (~> 3.9.0)
|
|
63
|
-
rspec-core (3.9.0)
|
|
64
|
-
rspec-support (~> 3.9.0)
|
|
65
|
-
rspec-expectations (3.9.0)
|
|
66
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
|
67
|
-
rspec-support (~> 3.9.0)
|
|
68
|
-
rspec-mocks (3.9.0)
|
|
69
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
|
70
|
-
rspec-support (~> 3.9.0)
|
|
71
|
-
rspec-support (3.9.0)
|
|
72
|
-
safe_yaml (1.0.5)
|
|
73
|
-
shellany (0.0.1)
|
|
74
|
-
simplecov (0.16.1)
|
|
75
|
-
docile (~> 1.1)
|
|
76
|
-
json (>= 1.8, < 3)
|
|
77
|
-
simplecov-html (~> 0.10.0)
|
|
78
|
-
simplecov-html (0.10.2)
|
|
79
|
-
term-ansicolor (1.7.1)
|
|
80
|
-
tins (~> 1.0)
|
|
81
|
-
thor (0.20.3)
|
|
82
|
-
tins (1.21.1)
|
|
83
|
-
vcr (4.0.0)
|
|
84
|
-
webmock (3.7.6)
|
|
85
|
-
addressable (>= 2.3.6)
|
|
86
|
-
crack (>= 0.3.2)
|
|
87
|
-
hashdiff (>= 0.4.0, < 2.0.0)
|
|
88
|
-
|
|
89
|
-
PLATFORMS
|
|
90
|
-
ruby
|
|
91
|
-
|
|
92
|
-
DEPENDENCIES
|
|
93
|
-
bundler (~> 1.16)
|
|
94
|
-
coveralls (~> 0.8)
|
|
95
|
-
groupme-api!
|
|
96
|
-
guard-rspec (~> 4.7)
|
|
97
|
-
rake (~> 10.0)
|
|
98
|
-
rspec (~> 3.8)
|
|
99
|
-
simplecov (~> 0.15)
|
|
100
|
-
vcr (~> 4.0)
|
|
101
|
-
webmock (~> 3.4)
|
|
102
|
-
|
|
103
|
-
BUNDLED WITH
|
|
104
|
-
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,33 +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
|
-
spec.license = 'MIT'
|
|
14
|
-
|
|
15
|
-
spec.author = 'Kinnell Shah'
|
|
16
|
-
spec.email = 'kinnell@gmail.com'
|
|
17
|
-
spec.homepage = 'https://github.com/kinnell/groupme-ruby-gem'
|
|
18
|
-
|
|
19
|
-
spec.files = `git ls-files`.split("\n")
|
|
20
|
-
spec.require_path = 'lib'
|
|
21
|
-
spec.required_ruby_version = Gem::Requirement.new('>= 2.3.0')
|
|
22
|
-
|
|
23
|
-
spec.add_dependency 'httpclient', '~> 2.8'
|
|
24
|
-
|
|
25
|
-
spec.add_development_dependency 'bundler', '~> 1.16'
|
|
26
|
-
spec.add_development_dependency 'coveralls', '~> 0.8'
|
|
27
|
-
spec.add_development_dependency 'guard-rspec', '~> 4.7'
|
|
28
|
-
spec.add_development_dependency 'rake', '~> 10.0'
|
|
29
|
-
spec.add_development_dependency 'rspec', '~> 3.8'
|
|
30
|
-
spec.add_development_dependency 'simplecov', '~> 0.15'
|
|
31
|
-
spec.add_development_dependency 'vcr', '~> 4.0'
|
|
32
|
-
spec.add_development_dependency 'webmock', '~> 3.4'
|
|
33
|
-
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,13 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
RSpec.describe GroupMe::Group do
|
|
4
|
-
include_context :with_default_groupme_configuration
|
|
5
|
-
|
|
6
|
-
describe '#all' do
|
|
7
|
-
it 'should send the correct HTTP request' do
|
|
8
|
-
_groups = GroupMe::Group.all
|
|
9
|
-
|
|
10
|
-
expect(WebMock).to have_requested(:get, 'https://api.groupme.com/v3/groups').with(query: { token: access_token, omit: :memberships, per_page: GroupMe.configuration.groups_per_page })
|
|
11
|
-
end
|
|
12
|
-
end
|
|
13
|
-
end
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
# frozen_string_literal: true
|
|
2
|
-
|
|
3
|
-
RSpec.describe GroupMe::ImageClient do
|
|
4
|
-
include_context :with_default_groupme_configuration
|
|
5
|
-
|
|
6
|
-
let(:image_blob) { '\x89PNG\r\n\x1A\n\x00\x00\x00\rIHDR\x00\x00\x00\x01\x00\x00\x00\x01\b\x03\x00\x00\x00(\xCB4\xBB\x00\x00\x00\x03PLTE\xDD.DX\x9D\x17\x1C\x00\x00\x00\x01tRNS\xD8\xC8\xEE\x82\x80\x00\x00\x00\nIDATx\x01c`\x00\x00\x00\x02\x00\x01su\x01\x18\x00\x00\x00\x00IEND\xAEB`\x82' }
|
|
7
|
-
|
|
8
|
-
describe '#new' do
|
|
9
|
-
it 'should send the correct HTTP request' do
|
|
10
|
-
_image_client = GroupMe::ImageClient.new
|
|
11
|
-
_image_client.upload(image_blob)
|
|
12
|
-
|
|
13
|
-
expect(WebMock).to have_requested(:post, 'https://image.groupme.com/pictures').with(body: image_blob)
|
|
14
|
-
end
|
|
15
|
-
end
|
|
16
|
-
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
|