groupme 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +6 -14
- data/.travis.yml +5 -6
- data/README.md +11 -4
- data/groupme.gemspec +4 -4
- data/lib/groupme/bots.rb +2 -2
- data/lib/groupme/client.rb +1 -1
- data/lib/groupme/groups.rb +14 -6
- data/lib/groupme/likes.rb +2 -2
- data/lib/groupme/members.rb +12 -2
- data/lib/groupme/messages.rb +4 -4
- data/lib/groupme/users.rb +1 -1
- data/lib/groupme/version.rb +1 -1
- data/spec/fixtures/group.json +38 -3
- data/spec/fixtures/groups.json +38 -3
- data/spec/fixtures/message.json +7 -2
- data/spec/fixtures/message_with_location.json +7 -2
- data/spec/fixtures/message_with_one_image.json +8 -3
- data/spec/fixtures/messages.json +27 -4
- data/spec/groupme/groups_spec.rb +10 -0
- data/spec/groupme/members_spec.rb +10 -0
- data/spec/groupme/messages_spec.rb +23 -13
- data/spec/spec_helper.rb +4 -2
- metadata +32 -32
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
metadata.gz: !binary |-
|
9
|
-
MjFmZWUwM2JhODc1ZDBlMDY1ZWJlZTJkYzMxYTA0MzUzMTQ4YzZiMDBlMjI5
|
10
|
-
ODQ1MTUyZjAxM2Y5MjgxODI1YzAxNzZjYWQwNDYzOTgzZWM5ZDc3YzljNTAx
|
11
|
-
OTQ0MmY2MmRhYjZhODg3NTU1MGIyMDJiNTY3MDMwZGEyNzBmNjM=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
NTRiNzg3MjM5ZTY0ZDhhZTI5ZjgwZWE4MTU1MWJiZTAxY2MwYWRhMGQ5MGQz
|
14
|
-
NDE4ZmRkNTc0ZmU3YjE3MGY2MzU4NThjZWU5N2I4M2M0ZDJjYWEzMzNmOTI4
|
15
|
-
MGUyYjEzMWM2NmYwZWMxOWQzNmY0ZWFlYWFhZGI5ZGUyZDIwNzQ=
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: fecf88030eeb7be396ea35744a6d7e26085323f1
|
4
|
+
data.tar.gz: 228d204cc36bbd8e14b5a14b98faaeb68c3a03cf
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: b8e010147a9db04362159b13f7419e304811f3537a02ad09fa29fa7aca8b94ca6e508ca329380606fe47bdf48d3d634bca052b226538e4bc82794d6f5623969c
|
7
|
+
data.tar.gz: 272ad5f24e2fc67dd3416f7bfb7dce63ddda077c4d4ba664904486b3e0efad1608ee66d63b553140fb10368ed12ff116e238bcba0c1692567db3b705df7ace3c
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# groupme [![Build Status](https://secure.travis-ci.org/dwradcliffe/groupme.png?branch=master)](https://travis-ci.org/dwradcliffe/groupme) [![Dependency Status](https://gemnasium.com/dwradcliffe/groupme.png)](https://gemnasium.com/dwradcliffe/groupme) [![Code Climate](https://codeclimate.com/github/dwradcliffe/groupme.png)](https://codeclimate.com/github/dwradcliffe/groupme) [![Gem Version](https://badge.fury.io/rb/groupme.png)](http://badge.fury.io/rb/groupme)
|
2
2
|
|
3
|
-
Simple wrapper for the GroupMe v3 API.
|
3
|
+
Simple wrapper for the [GroupMe v3 API](https://dev.groupme.com/docs/v3).
|
4
4
|
|
5
5
|
## Installation
|
6
6
|
|
@@ -17,10 +17,17 @@ Or install it yourself as:
|
|
17
17
|
$ gem install groupme
|
18
18
|
|
19
19
|
## Documentation
|
20
|
-
[http://rdoc.info/
|
20
|
+
[http://rdoc.info/gems/groupme/frames/index][documentation]
|
21
21
|
|
22
|
-
[documentation]: http://rdoc.info/
|
22
|
+
[documentation]: http://rdoc.info/gems/groupme/frames/index
|
23
23
|
|
24
24
|
## Usage
|
25
25
|
|
26
|
-
|
26
|
+
You will need to start with a client object:
|
27
|
+
|
28
|
+
@client = GroupMe::Client.new(:token => "TEST")
|
29
|
+
|
30
|
+
Then you can call any of the API methods on this object:
|
31
|
+
|
32
|
+
groups = @client.groups
|
33
|
+
new_group = @client.create_group("Family")
|
data/groupme.gemspec
CHANGED
@@ -19,15 +19,15 @@ Gem::Specification.new do |gem|
|
|
19
19
|
gem.require_paths = ["lib"]
|
20
20
|
|
21
21
|
gem.add_development_dependency 'rake'
|
22
|
-
gem.add_development_dependency 'rspec'
|
22
|
+
gem.add_development_dependency 'rspec', '~> 2.0'
|
23
23
|
gem.add_development_dependency 'webmock'
|
24
24
|
gem.add_development_dependency 'yard'
|
25
|
-
gem.add_development_dependency 'redcarpet', '~> 2.0'
|
26
25
|
gem.add_development_dependency 'pry'
|
27
26
|
gem.add_development_dependency 'json', '~> 1.7'
|
27
|
+
gem.add_development_dependency 'timecop', '~> 0.7'
|
28
28
|
|
29
|
-
gem.add_dependency 'faraday', '~> 0.8'
|
30
|
-
gem.add_dependency 'faraday_middleware', '~> 0.
|
29
|
+
gem.add_dependency 'faraday', '~> 0.8.8'
|
30
|
+
gem.add_dependency 'faraday_middleware', '~> 0.9.0'
|
31
31
|
gem.add_dependency 'hashie', '~> 2.0'
|
32
32
|
gem.add_dependency 'multi_json', '~> 1.3'
|
33
33
|
gem.add_dependency 'simple_oauth', '~> 0.2'
|
data/lib/groupme/bots.rb
CHANGED
@@ -4,7 +4,7 @@ module GroupMe
|
|
4
4
|
# List the authenticated user's bots.
|
5
5
|
#
|
6
6
|
# @return [Array<Hashie::Mash>] Array of hashes representing bots.
|
7
|
-
# @see
|
7
|
+
# @see https://dev.groupme.com/docs/v3#bots_index
|
8
8
|
# @example
|
9
9
|
# client = GroupMe::Client.new
|
10
10
|
# client.bots
|
@@ -16,7 +16,7 @@ module GroupMe
|
|
16
16
|
# Get a single bot.
|
17
17
|
#
|
18
18
|
# @return [Hashie::Mash] Hash representing the bot.
|
19
|
-
# @see
|
19
|
+
# @see https://dev.groupme.com/docs/v3#bots_show
|
20
20
|
# @example
|
21
21
|
# client = GroupMe::Client.new
|
22
22
|
# client.bot(32)
|
data/lib/groupme/client.rb
CHANGED
data/lib/groupme/groups.rb
CHANGED
@@ -4,7 +4,7 @@ module GroupMe
|
|
4
4
|
# List the authenticated user's active groups.
|
5
5
|
#
|
6
6
|
# @return [Array<Hashie::Mash>] Array of hashes representing groups.
|
7
|
-
# @see
|
7
|
+
# @see https://dev.groupme.com/docs/v3#groups_index
|
8
8
|
# @example
|
9
9
|
# client = GroupMe::Client.new
|
10
10
|
# client.groups
|
@@ -16,7 +16,7 @@ module GroupMe
|
|
16
16
|
# Load a specific group.
|
17
17
|
#
|
18
18
|
# @return [Hashie::Mash] Hash representing the group.
|
19
|
-
# @see
|
19
|
+
# @see https://dev.groupme.com/docs/v3#groups_show
|
20
20
|
# @param id [String, Integer] The ID of the group
|
21
21
|
# @example
|
22
22
|
# client = GroupMe::Client.new
|
@@ -28,7 +28,7 @@ module GroupMe
|
|
28
28
|
# List the authenticated user's former groups.
|
29
29
|
#
|
30
30
|
# @return [Array<Hashie::Mash>] Array of hashes representing groups.
|
31
|
-
# @see
|
31
|
+
# @see https://dev.groupme.com/docs/v3#groups_index_former
|
32
32
|
# @example
|
33
33
|
# client = GroupMe::Client.new
|
34
34
|
# client.former_groups
|
@@ -40,7 +40,7 @@ module GroupMe
|
|
40
40
|
# Create a new group.
|
41
41
|
#
|
42
42
|
# @return [Hashie::Mash] Hash representing the group
|
43
|
-
# @see
|
43
|
+
# @see https://dev.groupme.com/docs/v3#groups_create
|
44
44
|
# @param name [String] Name for the new group
|
45
45
|
# @param options [Hash] Group information
|
46
46
|
# @option options [String] :description Description of the group
|
@@ -54,7 +54,7 @@ module GroupMe
|
|
54
54
|
# Update a group after creation
|
55
55
|
#
|
56
56
|
# @return [Hashie::Mash] Hash representing the group
|
57
|
-
# @see
|
57
|
+
# @see https://dev.groupme.com/docs/v3#groups_update
|
58
58
|
# @param name [Integer] Group ID
|
59
59
|
# @param data [Hash] Group information
|
60
60
|
# @option data [String] :name Name of the group
|
@@ -68,10 +68,18 @@ module GroupMe
|
|
68
68
|
# Disband a group
|
69
69
|
#
|
70
70
|
# @return [Boolean] Success/Failure
|
71
|
-
# @see
|
71
|
+
# @see https://dev.groupme.com/docs/v3#groups_destroy
|
72
72
|
def destroy_group(group_id)
|
73
73
|
post("/groups/#{group_id}/destroy").status == 200
|
74
74
|
end
|
75
75
|
|
76
|
+
# Join a shared group
|
77
|
+
#
|
78
|
+
# @return [Boolean] Success/Failure
|
79
|
+
# @see https://dev.groupme.com/docs/v3#groups_join
|
80
|
+
def join_group(group_id, share_token)
|
81
|
+
post("/groups/#{group_id}/join/#{share_token}").status == 200
|
82
|
+
end
|
83
|
+
|
76
84
|
end
|
77
85
|
end
|
data/lib/groupme/likes.rb
CHANGED
@@ -4,7 +4,7 @@ module GroupMe
|
|
4
4
|
# Like a message
|
5
5
|
#
|
6
6
|
# @return [Boolean] Success/Failure
|
7
|
-
# @see
|
7
|
+
# @see https://dev.groupme.com/docs/v3#likes_create
|
8
8
|
def create_like(group_id, message_id)
|
9
9
|
post("/messages/#{group_id}/#{message_id}/like").status == 200
|
10
10
|
end
|
@@ -12,7 +12,7 @@ module GroupMe
|
|
12
12
|
# Unlike a liked message
|
13
13
|
#
|
14
14
|
# @return [Boolean] Success/Failure
|
15
|
-
# @see
|
15
|
+
# @see https://dev.groupme.com/docs/v3#likes_destroy
|
16
16
|
def destroy_like(group_id, message_id)
|
17
17
|
post("/messages/#{group_id}/#{message_id}/unlike").status == 200
|
18
18
|
end
|
data/lib/groupme/members.rb
CHANGED
@@ -4,7 +4,7 @@ module GroupMe
|
|
4
4
|
# Add members to a group
|
5
5
|
#
|
6
6
|
# @return [Boolean] Success/Failure
|
7
|
-
# @see
|
7
|
+
# @see https://dev.groupme.com/docs/v3#members_add
|
8
8
|
# @param id [String, Integer] Id of the group
|
9
9
|
# @param members [Array<Hash>] Members to be added
|
10
10
|
# @option members [String] :nickname
|
@@ -19,7 +19,7 @@ module GroupMe
|
|
19
19
|
# Add member to a group
|
20
20
|
#
|
21
21
|
# @return [Boolean] Success/Failure
|
22
|
-
# @see
|
22
|
+
# @see https://dev.groupme.com/docs/v3#members_add
|
23
23
|
# @param id [String, Integer] Id of the group
|
24
24
|
# @param member [Hash] Member to be added
|
25
25
|
# @option member [String] :nickname
|
@@ -31,5 +31,15 @@ module GroupMe
|
|
31
31
|
post("/groups/#{id}/members/add", [member]).status == 202
|
32
32
|
end
|
33
33
|
|
34
|
+
# Remove a member from a group
|
35
|
+
#
|
36
|
+
# @return [Boolean] Success/Failure
|
37
|
+
# @see https://dev.groupme.com/docs/v3#members_remove
|
38
|
+
# @param group_id [String, Integer] Id of the group
|
39
|
+
# @param member_id [String, Integer] Id of the member
|
40
|
+
def remove_member(group_id, member_id)
|
41
|
+
post("/groups/#{group_id}/members/#{member_id}/remove").status == 200
|
42
|
+
end
|
43
|
+
|
34
44
|
end
|
35
45
|
end
|
data/lib/groupme/messages.rb
CHANGED
@@ -4,14 +4,14 @@ module GroupMe
|
|
4
4
|
# Create a message for a group
|
5
5
|
#
|
6
6
|
# @return [Hashie::Mash] Hash representing the message
|
7
|
-
# @see
|
7
|
+
# @see https://dev.groupme.com/docs/v3#messages_create
|
8
8
|
# @param group_id [String, Integer] Id of the group
|
9
9
|
# @param text [String] Text of the message
|
10
10
|
# @param attachments [Array<Hash>] Array of attachments
|
11
11
|
def create_message(group_id, text, attachments=[])
|
12
12
|
data = {
|
13
13
|
:message => {
|
14
|
-
:source_guid =>
|
14
|
+
:source_guid => Time.now.to_s,
|
15
15
|
:text => text
|
16
16
|
}
|
17
17
|
}
|
@@ -22,7 +22,7 @@ module GroupMe
|
|
22
22
|
# List messages for a group
|
23
23
|
#
|
24
24
|
# @return [Array<Hashie::Mash>] Array of hashes representing the messages
|
25
|
-
# @see
|
25
|
+
# @see https://dev.groupme.com/docs/v3#messages_index
|
26
26
|
# @param group_id [String, Integer] Id of the group
|
27
27
|
def messages(group_id)
|
28
28
|
get("/groups/#{group_id}/messages").messages
|
@@ -38,4 +38,4 @@ module GroupMe
|
|
38
38
|
alias :message_count :messages_count
|
39
39
|
|
40
40
|
end
|
41
|
-
end
|
41
|
+
end
|
data/lib/groupme/users.rb
CHANGED
data/lib/groupme/version.rb
CHANGED
data/spec/fixtures/group.json
CHANGED
@@ -3,7 +3,7 @@
|
|
3
3
|
"name": "Family",
|
4
4
|
"type": "private",
|
5
5
|
"description": "Coolest Family Ever",
|
6
|
-
"image_url": "http://i.groupme.com/123456789
|
6
|
+
"image_url": "http://i.groupme.com/123456789",
|
7
7
|
"creator_user_id": "1234567890",
|
8
8
|
"created_at": 1302623328,
|
9
9
|
"updated_at": 1302623328,
|
@@ -12,9 +12,10 @@
|
|
12
12
|
"user_id": "1234567890",
|
13
13
|
"nickname": "Jane",
|
14
14
|
"muted": false,
|
15
|
-
"image_url": "http://i.groupme.com/123456789
|
15
|
+
"image_url": "http://i.groupme.com/123456789"
|
16
16
|
}
|
17
17
|
],
|
18
|
+
"share_url": "https://groupme.com/join_group/1234567890/SHARE_TOKEN",
|
18
19
|
"messages": {
|
19
20
|
"count": 100,
|
20
21
|
"last_message_id": "1234567890",
|
@@ -22,7 +23,41 @@
|
|
22
23
|
"preview": {
|
23
24
|
"nickname": "Jane",
|
24
25
|
"text": "Hello world",
|
25
|
-
"image_url": "http://i.groupme.com/123456789
|
26
|
+
"image_url": "http://i.groupme.com/123456789",
|
27
|
+
"attachments": [
|
28
|
+
{
|
29
|
+
"type": "image",
|
30
|
+
"url": "http://i.groupme.com/123456789"
|
31
|
+
},
|
32
|
+
{
|
33
|
+
"type": "image",
|
34
|
+
"url": "http://i.groupme.com/123456789"
|
35
|
+
},
|
36
|
+
{
|
37
|
+
"type": "location",
|
38
|
+
"lat": "40.738206",
|
39
|
+
"lng": "-73.993285",
|
40
|
+
"name": "GroupMe HQ"
|
41
|
+
},
|
42
|
+
{
|
43
|
+
"type": "split",
|
44
|
+
"token": "SPLIT_TOKEN"
|
45
|
+
},
|
46
|
+
{
|
47
|
+
"type": "emoji",
|
48
|
+
"placeholder": "☃",
|
49
|
+
"charmap": [
|
50
|
+
[
|
51
|
+
1,
|
52
|
+
42
|
53
|
+
],
|
54
|
+
[
|
55
|
+
2,
|
56
|
+
34
|
57
|
+
]
|
58
|
+
]
|
59
|
+
}
|
60
|
+
]
|
26
61
|
}
|
27
62
|
}
|
28
63
|
}
|
data/spec/fixtures/groups.json
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
"name": "Family",
|
5
5
|
"type": "private",
|
6
6
|
"description": "Coolest Family Ever",
|
7
|
-
"image_url": "http://i.groupme.com/123456789
|
7
|
+
"image_url": "http://i.groupme.com/123456789",
|
8
8
|
"creator_user_id": "1234567890",
|
9
9
|
"created_at": 1302623328,
|
10
10
|
"updated_at": 1302623328,
|
@@ -13,9 +13,10 @@
|
|
13
13
|
"user_id": "1234567890",
|
14
14
|
"nickname": "Jane",
|
15
15
|
"muted": false,
|
16
|
-
"image_url": "http://i.groupme.com/123456789
|
16
|
+
"image_url": "http://i.groupme.com/123456789"
|
17
17
|
}
|
18
18
|
],
|
19
|
+
"share_url": "https://groupme.com/join_group/1234567890/SHARE_TOKEN",
|
19
20
|
"messages": {
|
20
21
|
"count": 100,
|
21
22
|
"last_message_id": "1234567890",
|
@@ -23,7 +24,41 @@
|
|
23
24
|
"preview": {
|
24
25
|
"nickname": "Jane",
|
25
26
|
"text": "Hello world",
|
26
|
-
"image_url": "http://i.groupme.com/123456789
|
27
|
+
"image_url": "http://i.groupme.com/123456789",
|
28
|
+
"attachments": [
|
29
|
+
{
|
30
|
+
"type": "image",
|
31
|
+
"url": "http://i.groupme.com/123456789"
|
32
|
+
},
|
33
|
+
{
|
34
|
+
"type": "image",
|
35
|
+
"url": "http://i.groupme.com/123456789"
|
36
|
+
},
|
37
|
+
{
|
38
|
+
"type": "location",
|
39
|
+
"lat": "40.738206",
|
40
|
+
"lng": "-73.993285",
|
41
|
+
"name": "GroupMe HQ"
|
42
|
+
},
|
43
|
+
{
|
44
|
+
"type": "split",
|
45
|
+
"token": "SPLIT_TOKEN"
|
46
|
+
},
|
47
|
+
{
|
48
|
+
"type": "emoji",
|
49
|
+
"placeholder": "☃",
|
50
|
+
"charmap": [
|
51
|
+
[
|
52
|
+
1,
|
53
|
+
42
|
54
|
+
],
|
55
|
+
[
|
56
|
+
2,
|
57
|
+
34
|
58
|
+
]
|
59
|
+
]
|
60
|
+
}
|
61
|
+
]
|
27
62
|
}
|
28
63
|
}
|
29
64
|
}
|
data/spec/fixtures/message.json
CHANGED
@@ -6,9 +6,14 @@
|
|
6
6
|
"user_id": "1234567890",
|
7
7
|
"group_id": "1234567890",
|
8
8
|
"name": "John",
|
9
|
-
"avatar_url": "http://i.groupme.com/123456789
|
10
|
-
"text": "Hello world",
|
9
|
+
"avatar_url": "http://i.groupme.com/123456789",
|
10
|
+
"text": "Hello world ☃☃",
|
11
11
|
"system": true,
|
12
|
+
"favorited_by": [
|
13
|
+
"101",
|
14
|
+
"66",
|
15
|
+
"1234567890"
|
16
|
+
],
|
12
17
|
"attachments": []
|
13
18
|
}
|
14
19
|
}
|
@@ -6,9 +6,14 @@
|
|
6
6
|
"user_id": "1234567890",
|
7
7
|
"group_id": "1234567890",
|
8
8
|
"name": "John",
|
9
|
-
"avatar_url": "http://i.groupme.com/123456789
|
10
|
-
"text": "Hello world",
|
9
|
+
"avatar_url": "http://i.groupme.com/123456789",
|
10
|
+
"text": "Hello world ☃☃",
|
11
11
|
"system": true,
|
12
|
+
"favorited_by": [
|
13
|
+
"101",
|
14
|
+
"66",
|
15
|
+
"1234567890"
|
16
|
+
],
|
12
17
|
"attachments": [
|
13
18
|
{
|
14
19
|
"type": "location",
|
@@ -6,13 +6,18 @@
|
|
6
6
|
"user_id": "1234567890",
|
7
7
|
"group_id": "1234567890",
|
8
8
|
"name": "John",
|
9
|
-
"avatar_url": "http://i.groupme.com/123456789
|
10
|
-
"text": "Hello world",
|
9
|
+
"avatar_url": "http://i.groupme.com/123456789",
|
10
|
+
"text": "Hello world ☃☃",
|
11
11
|
"system": true,
|
12
|
+
"favorited_by": [
|
13
|
+
"101",
|
14
|
+
"66",
|
15
|
+
"1234567890"
|
16
|
+
],
|
12
17
|
"attachments": [
|
13
18
|
{
|
14
19
|
"type": "image",
|
15
|
-
"url": "http://i.groupme.com/123456789
|
20
|
+
"url": "http://i.groupme.com/123456789"
|
16
21
|
}
|
17
22
|
]
|
18
23
|
}
|
data/spec/fixtures/messages.json
CHANGED
@@ -8,23 +8,46 @@
|
|
8
8
|
"user_id": "1234567890",
|
9
9
|
"group_id": "1234567890",
|
10
10
|
"name": "John",
|
11
|
-
"avatar_url": "http://i.groupme.com/123456789
|
12
|
-
"text": "Hello world",
|
11
|
+
"avatar_url": "http://i.groupme.com/123456789",
|
12
|
+
"text": "Hello world ☃☃",
|
13
13
|
"system": true,
|
14
|
+
"favorited_by": [
|
15
|
+
"101",
|
16
|
+
"66",
|
17
|
+
"1234567890"
|
18
|
+
],
|
14
19
|
"attachments": [
|
15
20
|
{
|
16
21
|
"type": "image",
|
17
|
-
"url": "http://i.groupme.com/123456789
|
22
|
+
"url": "http://i.groupme.com/123456789"
|
18
23
|
},
|
19
24
|
{
|
20
25
|
"type": "image",
|
21
|
-
"url": "http://i.groupme.com/123456789
|
26
|
+
"url": "http://i.groupme.com/123456789"
|
22
27
|
},
|
23
28
|
{
|
24
29
|
"type": "location",
|
25
30
|
"lat": "40.738206",
|
26
31
|
"lng": "-73.993285",
|
27
32
|
"name": "GroupMe HQ"
|
33
|
+
},
|
34
|
+
{
|
35
|
+
"type": "split",
|
36
|
+
"token": "SPLIT_TOKEN"
|
37
|
+
},
|
38
|
+
{
|
39
|
+
"type": "emoji",
|
40
|
+
"placeholder": "☃",
|
41
|
+
"charmap": [
|
42
|
+
[
|
43
|
+
1,
|
44
|
+
42
|
45
|
+
],
|
46
|
+
[
|
47
|
+
2,
|
48
|
+
34
|
49
|
+
]
|
50
|
+
]
|
28
51
|
}
|
29
52
|
]
|
30
53
|
}
|
data/spec/groupme/groups_spec.rb
CHANGED
@@ -72,4 +72,14 @@ describe GroupMe::Groups do
|
|
72
72
|
|
73
73
|
end
|
74
74
|
|
75
|
+
describe ".join_group" do
|
76
|
+
|
77
|
+
it "joins a shared group" do
|
78
|
+
stub_post("/groups/4/join/1234asdf").to_return(:status => 200)
|
79
|
+
response = @client.join_group(4, '1234asdf')
|
80
|
+
expect(response).to eq(true)
|
81
|
+
end
|
82
|
+
|
83
|
+
end
|
84
|
+
|
75
85
|
end
|
@@ -44,4 +44,14 @@ describe GroupMe::Members do
|
|
44
44
|
|
45
45
|
end
|
46
46
|
|
47
|
+
describe '.remove_member' do
|
48
|
+
|
49
|
+
it 'removes a member from the group' do
|
50
|
+
stub_post("/groups/1/members/234/remove").to_return(:status => 200)
|
51
|
+
response = @client.remove_member(1, 234)
|
52
|
+
expect(response).to eq(true)
|
53
|
+
end
|
54
|
+
|
55
|
+
end
|
56
|
+
|
47
57
|
end
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
|
3
5
|
describe GroupMe::Messages do
|
@@ -20,30 +22,38 @@ describe GroupMe::Messages do
|
|
20
22
|
it "returns messages for a group" do
|
21
23
|
stub_get("/groups/1/messages").to_return(json_response("messages.json"))
|
22
24
|
messages = @client.messages(1)
|
23
|
-
expect(messages.first.text).to eq("Hello world")
|
25
|
+
expect(messages.first.text).to eq("Hello world ☃☃")
|
24
26
|
end
|
25
27
|
|
26
28
|
end
|
27
29
|
|
28
30
|
describe ".create_message" do
|
29
31
|
|
32
|
+
before do
|
33
|
+
Timecop.freeze(Time.new(2014, 10, 25, 22, 33, 44, 0000))
|
34
|
+
end
|
35
|
+
|
36
|
+
after do
|
37
|
+
Timecop.return
|
38
|
+
end
|
39
|
+
|
30
40
|
it "sends a text only message to a group" do
|
31
41
|
message = {
|
32
42
|
:message => {
|
33
|
-
:source_guid =>
|
34
|
-
:text => "Hello world",
|
43
|
+
:source_guid => '2014-10-25 22:33:44 +0000',
|
44
|
+
:text => "Hello world ☃☃",
|
35
45
|
}
|
36
46
|
}
|
37
|
-
stub_post("/groups/1/messages", message).to_return(json_response("message.json"))
|
38
|
-
message = @client.create_message(1, "Hello world")
|
39
|
-
expect(message.text).to eq("Hello world")
|
47
|
+
stub_post("/groups/1/messages", message).to_return(json_response("message.json", 201))
|
48
|
+
message = @client.create_message(1, "Hello world ☃☃")
|
49
|
+
expect(message.text).to eq("Hello world ☃☃")
|
40
50
|
end
|
41
51
|
|
42
52
|
it "sends a message with location to a group" do
|
43
53
|
message = {
|
44
54
|
:message => {
|
45
|
-
:source_guid =>
|
46
|
-
:text => "Hello world",
|
55
|
+
:source_guid => '2014-10-25 22:33:44 +0000',
|
56
|
+
:text => "Hello world ☃☃",
|
47
57
|
:attachments => [
|
48
58
|
{
|
49
59
|
:type => "location",
|
@@ -54,11 +64,11 @@ describe GroupMe::Messages do
|
|
54
64
|
]
|
55
65
|
}
|
56
66
|
}
|
57
|
-
stub_post("/groups/1/messages", message).to_return(json_response("message_with_location.json"))
|
58
|
-
|
67
|
+
stub_post("/groups/1/messages", message).to_return(json_response("message_with_location.json", 201))
|
68
|
+
|
59
69
|
att = { :type => "location", :lat => "40.738206", :lng => "-73.993285", :name => "GroupMe HQ" }
|
60
|
-
message = @client.create_message(1, "Hello world", [att])
|
61
|
-
expect(message.text).to eq("Hello world")
|
70
|
+
message = @client.create_message(1, "Hello world ☃☃", [att])
|
71
|
+
expect(message.text).to eq("Hello world ☃☃")
|
62
72
|
expect(message.attachments.count).to eq(1)
|
63
73
|
expect(message.attachments.first.type).to eq("location")
|
64
74
|
expect(message.attachments.first.lat).to eq("40.738206")
|
@@ -67,4 +77,4 @@ describe GroupMe::Messages do
|
|
67
77
|
|
68
78
|
end
|
69
79
|
|
70
|
-
end
|
80
|
+
end
|
data/spec/spec_helper.rb
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'groupme'
|
2
2
|
require 'multi_json'
|
3
3
|
require 'webmock/rspec'
|
4
|
+
require 'timecop'
|
4
5
|
|
5
6
|
def stub_get(url)
|
6
7
|
stub_request(:get, "https://api.groupme.com/v3#{url}")
|
@@ -18,12 +19,13 @@ def fixture(file)
|
|
18
19
|
MultiJson.load(File.read(fixture_path + '/' + file))
|
19
20
|
end
|
20
21
|
|
21
|
-
def json_response(file)
|
22
|
+
def json_response(file, status = 200)
|
22
23
|
{
|
24
|
+
:status => status,
|
23
25
|
:body => {
|
24
26
|
:response => fixture(file),
|
25
27
|
:meta => {
|
26
|
-
:code =>
|
28
|
+
:code => status,
|
27
29
|
:errors => []
|
28
30
|
}
|
29
31
|
},
|
metadata
CHANGED
@@ -1,141 +1,141 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: groupme
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Radcliffe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-10-26 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - '>='
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - '>='
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rspec
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - ~>
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0'
|
33
|
+
version: '2.0'
|
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: '0'
|
40
|
+
version: '2.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: webmock
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - '>='
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: yard
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - '>='
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- -
|
66
|
+
- - '>='
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: pry
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - '>='
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
75
|
+
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - '>='
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
82
|
+
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
84
|
+
name: json
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - ~>
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: '
|
89
|
+
version: '1.7'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - ~>
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: '
|
96
|
+
version: '1.7'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
98
|
+
name: timecop
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - ~>
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: '
|
103
|
+
version: '0.7'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - ~>
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: '
|
110
|
+
version: '0.7'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: faraday
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
115
|
- - ~>
|
116
116
|
- !ruby/object:Gem::Version
|
117
|
-
version:
|
117
|
+
version: 0.8.8
|
118
118
|
type: :runtime
|
119
119
|
prerelease: false
|
120
120
|
version_requirements: !ruby/object:Gem::Requirement
|
121
121
|
requirements:
|
122
122
|
- - ~>
|
123
123
|
- !ruby/object:Gem::Version
|
124
|
-
version:
|
124
|
+
version: 0.8.8
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
126
|
name: faraday_middleware
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
129
|
- - ~>
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version:
|
131
|
+
version: 0.9.0
|
132
132
|
type: :runtime
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
136
|
- - ~>
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version:
|
138
|
+
version: 0.9.0
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
140
|
name: hashie
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
@@ -233,17 +233,17 @@ require_paths:
|
|
233
233
|
- lib
|
234
234
|
required_ruby_version: !ruby/object:Gem::Requirement
|
235
235
|
requirements:
|
236
|
-
- -
|
236
|
+
- - '>='
|
237
237
|
- !ruby/object:Gem::Version
|
238
238
|
version: '0'
|
239
239
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
240
240
|
requirements:
|
241
|
-
- -
|
241
|
+
- - '>='
|
242
242
|
- !ruby/object:Gem::Version
|
243
243
|
version: '0'
|
244
244
|
requirements: []
|
245
245
|
rubyforge_project:
|
246
|
-
rubygems_version: 2.0.
|
246
|
+
rubygems_version: 2.0.14
|
247
247
|
signing_key:
|
248
248
|
specification_version: 4
|
249
249
|
summary: Simple wrapper for the GroupMe v3 API
|