groupme 0.0.5 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f9efa0010031499e84ebc41ae3c08dfff3666cb9
4
- data.tar.gz: 92bfa4bce484a5fcfdf7c569ea27daaf8d10dab2
3
+ metadata.gz: beee1256374c71c931f8ce107f28005b1da3aacf
4
+ data.tar.gz: 46c04187b65b33274566b40d85499837d9573e46
5
5
  SHA512:
6
- metadata.gz: 86ac4f57dd5cab2d93e75be8cbb8972716f640cde77ada1702823b6a828eed5d52613b1bdcaf38cc10423d72086cfa01cc24e37396b85e47944b88ec4ea8efa2
7
- data.tar.gz: 23045129f88e7342cd30efb40f9b13a2a4f00f0c1eae941f890a68533793e30ef3b346a8f413bdf914d9ac2a7309792f7e3ea5137e219d656536ec2766ff57d9
6
+ metadata.gz: e44752ae6a85469077509891d97005744309705185db4d3712a2d968a17237be227c2c0b10f8d8d7104988a8788dd144aaecb4cec7ce86ab31d4de9eabda8672
7
+ data.tar.gz: adf70ee47a11e9d7dfddce253443f80fab005b92b6fb9a3b138941e35415d8bb963d936881f40dbf85f890cf5934aa99dc9dcdbf9971fdb0e70d555ae6312a16
@@ -0,0 +1,18 @@
1
+ AllCops:
2
+ DisplayCopNames: true
3
+ DisplayStyleGuide: true
4
+
5
+ Style/Documentation:
6
+ Enabled: false
7
+ Style/HashSyntax:
8
+ EnforcedStyle: hash_rockets
9
+ Metrics/MethodLength:
10
+ Max: 13
11
+ Metrics/LineLength:
12
+ Max: 106
13
+ Style/NumericLiterals:
14
+ Enabled: false
15
+ Style/SpecialGlobalVars:
16
+ Enabled: false
17
+ Style/EmptyLinesAroundBlockBody:
18
+ Enabled: false
@@ -1,8 +1,9 @@
1
1
  language: ruby
2
+ sudo: false
2
3
  rvm:
3
- - 1.9.3
4
- - 2.0.0
5
- - 2.1
4
+ - 2.0
5
+ - 2.1.6
6
+ - 2.2.2
6
7
  - ruby-head
7
8
  - rbx-2
8
9
  - jruby
data/Rakefile CHANGED
@@ -1,10 +1,16 @@
1
- require "bundler/gem_tasks"
1
+ require 'bundler/gem_tasks'
2
2
 
3
3
  require 'rspec/core/rake_task'
4
4
  RSpec::Core::RakeTask.new(:spec)
5
5
 
6
- task :test => :spec
7
- task :default => :spec
6
+ task :test => [:spec, :rubocop]
7
+ task :default => :test
8
+
9
+ require 'rubocop/rake_task'
10
+ desc 'Execute rubocop'
11
+ RuboCop::RakeTask.new(:rubocop) do |task|
12
+ task.fail_on_error = true
13
+ end
8
14
 
9
15
  namespace :doc do
10
16
  require 'yard'
@@ -12,7 +18,7 @@ namespace :doc do
12
18
  task.files = ['README.md', 'LICENSE.md', 'lib/**/*.rb']
13
19
  task.options = [
14
20
  '--output-dir', 'doc/yard',
15
- '--markup', 'markdown',
21
+ '--markup', 'markdown'
16
22
  ]
17
23
  end
18
- end
24
+ end
@@ -4,27 +4,28 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
  require 'groupme/version'
5
5
 
6
6
  Gem::Specification.new do |gem|
7
- gem.name = "groupme"
7
+ gem.name = 'groupme'
8
8
  gem.version = GroupMe::VERSION
9
- gem.authors = ["David Radcliffe"]
10
- gem.email = ["radcliffe.david@gmail.com"]
11
- gem.description = %q{Simple wrapper for the GroupMe v3 API}
9
+ gem.authors = ['David Radcliffe']
10
+ gem.email = ['radcliffe.david@gmail.com']
11
+ gem.description = 'Simple wrapper for the GroupMe v3 API'
12
12
  gem.summary = gem.description
13
- gem.homepage = "https://github.com/dwradcliffe/groupme"
13
+ gem.homepage = 'https://github.com/dwradcliffe/groupme'
14
14
  gem.licenses = ['MIT']
15
15
 
16
16
  gem.files = `git ls-files`.split($/)
17
- gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
17
+ gem.executables = gem.files.grep(%r{^bin/}).map { |f| File.basename(f) }
18
18
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
19
- gem.require_paths = ["lib"]
19
+ gem.require_paths = ['lib']
20
20
 
21
21
  gem.add_development_dependency 'rake'
22
22
  gem.add_development_dependency 'rspec', '~> 3.0'
23
- gem.add_development_dependency 'webmock'
23
+ gem.add_development_dependency 'webmock', '~> 1.19.0'
24
24
  gem.add_development_dependency 'yard'
25
25
  gem.add_development_dependency 'pry'
26
26
  gem.add_development_dependency 'json', '~> 1.7'
27
27
  gem.add_development_dependency 'timecop', '~> 0.7'
28
+ gem.add_development_dependency 'rubocop', '~> 0.33'
28
29
 
29
30
  gem.add_dependency 'faraday', '~> 0.9.0'
30
31
  gem.add_dependency 'faraday_middleware', '~> 0.9.0'
@@ -1,5 +1,5 @@
1
- require "groupme/version"
2
- require "groupme/client"
1
+ require 'groupme/version'
2
+ require 'groupme/client'
3
3
 
4
4
  module GroupMe
5
5
  USER_AGENT = "dwradcliffe/groupme/#{GroupMe::VERSION}"
@@ -1,6 +1,5 @@
1
1
  module GroupMe
2
2
  module Bots
3
-
4
3
  # List the authenticated user's bots.
5
4
  #
6
5
  # @return [Array<Hashie::Mash>] Array of hashes representing bots.
@@ -9,21 +8,51 @@ module GroupMe
9
8
  # client = GroupMe::Client.new
10
9
  # client.bots
11
10
  def bots
12
- get("/bots")
11
+ get('/bots')
13
12
  end
14
- alias :list_bots :bots
13
+ alias_method :list_bots, :bots
15
14
 
16
- # Get a single bot.
15
+ # Post a message from a bot.
17
16
  #
18
- # @return [Hashie::Mash] Hash representing the bot.
19
- # @see https://dev.groupme.com/docs/v3#bots_show
20
- # @example
21
- # client = GroupMe::Client.new
22
- # client.bot(32)
23
- def bot(id)
24
- get("/bots/#{id}")
17
+ # @return [Boolean] Success/Failure
18
+ # @see https://dev.groupme.com/docs/v3#bots_post
19
+ # @param id [String, Integer] ID of the bot
20
+ # @param text [String] Text to send to the group
21
+ # @option options [String] :picture_url Picture URL from image service
22
+ def bot_post(id, text, options = {})
23
+ data = {
24
+ :bot_id => id,
25
+ :text => text
26
+ }
27
+ data[:options] = options if options.any?
28
+ post('/bots/post', data).status == 202
25
29
  end
26
30
 
31
+ # Create a new bot.
32
+ #
33
+ # @return [Hashie::Mash] Hash representing the bot.
34
+ # @see https://dev.groupme.com/docs/v3#bots_create
35
+ # @param name [String] Name for the new bot
36
+ # @param group_id [String, Integer] ID of the group
37
+ # @option options [String] :avatar_url Avatar image URL for the bot
38
+ # @option options [String] :callback_url Callback URL for the bot
39
+ def create_bot(name, group_id, options = {})
40
+ data = {
41
+ :bot => options.merge(:name => name, :group_id => group_id)
42
+ }
43
+ post('/bots', data)
44
+ end
27
45
 
46
+ # Remove a bot.
47
+ #
48
+ # @return [Boolean] Success/Failure
49
+ # @see https://dev.groupme.com/docs/v3#bots_destroy
50
+ # @param id [String, Integer] ID of the bot
51
+ def destroy_bot(id)
52
+ data = {
53
+ :bot_id => id
54
+ }
55
+ post('/bots/destroy', data).status == 200
56
+ end
28
57
  end
29
- end
58
+ end
@@ -8,10 +8,9 @@ require 'faraday_middleware'
8
8
 
9
9
  module GroupMe
10
10
  class Client
11
-
12
- def initialize(options={})
11
+ def initialize(options = {})
13
12
  @token = options[:token].to_s
14
- raise ArgumentError, ":token can't be blank" if @token.empty?
13
+ fail ArgumentError, ":token can't be blank" if @token.empty?
15
14
  end
16
15
 
17
16
  include GroupMe::Groups
@@ -23,39 +22,38 @@ module GroupMe
23
22
 
24
23
  private
25
24
 
26
- def get(path)
27
- request(:get, path)
28
- end
25
+ def get(path)
26
+ request(:get, path)
27
+ end
29
28
 
30
- def post(path, data={})
31
- request(:post, path, data)
32
- end
29
+ def post(path, data = {})
30
+ request(:post, path, data)
31
+ end
33
32
 
34
- def request(method, path, data={})
35
- res = connection.send(method, "v3/#{path}", data)
36
- if res.success? and !res.body.empty?
37
- return res.body.response
38
- else
39
- return res
40
- end
33
+ def request(method, path, data = {})
34
+ res = connection.send(method, "v3/#{path}", data)
35
+ if res.success? && !res.body.empty? && res.body != ' '
36
+ return res.body.response
37
+ else
38
+ return res
41
39
  end
40
+ end
42
41
 
43
- # Returns a Faraday::Connection object
44
- #
45
- # @return [Faraday::Connection]
46
- def connection
47
- @connection ||= Faraday.new 'https://api.groupme.com/' do |f|
48
- f.request :json
49
- f.headers[:user_agent] = GroupMe::USER_AGENT
50
- f.headers["X-Access-Token"] = @token
51
-
52
- # f.response :logger
53
- f.response :mashify
54
- f.response :json, :content_type => /\bjson$/
55
-
56
- f.adapter Faraday.default_adapter
57
- end
58
- end
42
+ # Returns a Faraday::Connection object
43
+ #
44
+ # @return [Faraday::Connection]
45
+ def connection
46
+ @connection ||= Faraday.new 'https://api.groupme.com/' do |f|
47
+ f.request :json
48
+ f.headers[:user_agent] = GroupMe::USER_AGENT
49
+ f.headers['X-Access-Token'] = @token
50
+
51
+ # f.response :logger
52
+ f.response :mashify
53
+ f.response :json, :content_type => /\bjson$/
59
54
 
55
+ f.adapter Faraday.default_adapter
56
+ end
57
+ end
60
58
  end
61
- end
59
+ end
@@ -1,6 +1,5 @@
1
1
  module GroupMe
2
2
  module Groups
3
-
4
3
  # List the authenticated user's active groups.
5
4
  #
6
5
  # @return [Array<Hashie::Mash>] Array of hashes representing groups.
@@ -9,9 +8,9 @@ module GroupMe
9
8
  # client = GroupMe::Client.new
10
9
  # client.groups
11
10
  def groups
12
- get "/groups"
11
+ get '/groups'
13
12
  end
14
- alias :list_groups :groups
13
+ alias_method :list_groups, :groups
15
14
 
16
15
  # Load a specific group.
17
16
  #
@@ -35,7 +34,7 @@ module GroupMe
35
34
  def former_groups
36
35
  get '/groups/former'
37
36
  end
38
- alias :list_former_groups :former_groups
37
+ alias_method :list_former_groups, :former_groups
39
38
 
40
39
  # Create a new group.
41
40
  #
@@ -46,7 +45,7 @@ module GroupMe
46
45
  # @option options [String] :description Description of the group
47
46
  # @option options [String] :image_url GroupMe Image Service URL
48
47
  # @option options [Boolean] :share If you pass a true value, a share URL will be generated
49
- def create_group(name, options={})
48
+ def create_group(name, options = {})
50
49
  options.merge! :name => name
51
50
  post '/groups', options
52
51
  end
@@ -80,6 +79,5 @@ module GroupMe
80
79
  def join_group(group_id, share_token)
81
80
  post("/groups/#{group_id}/join/#{share_token}").status == 200
82
81
  end
83
-
84
82
  end
85
- end
83
+ end
@@ -1,6 +1,5 @@
1
1
  module GroupMe
2
2
  module Likes
3
-
4
3
  # Like a message
5
4
  #
6
5
  # @return [Boolean] Success/Failure
@@ -16,6 +15,5 @@ module GroupMe
16
15
  def destroy_like(group_id, message_id)
17
16
  post("/messages/#{group_id}/#{message_id}/unlike").status == 200
18
17
  end
19
-
20
18
  end
21
- end
19
+ end
@@ -1,6 +1,5 @@
1
1
  module GroupMe
2
2
  module Members
3
-
4
3
  # Add members to a group
5
4
  #
6
5
  # @return [Boolean] Success/Failure
@@ -50,6 +49,5 @@ module GroupMe
50
49
  def membership_results(group_id, results_id)
51
50
  get("/groups/#{group_id}/members/results/#{results_id}").members
52
51
  end
53
-
54
52
  end
55
- end
53
+ end
@@ -1,6 +1,5 @@
1
1
  module GroupMe
2
2
  module Messages
3
-
4
3
  # Create a message for a group
5
4
  #
6
5
  # @return [Hashie::Mash] Hash representing the message
@@ -8,7 +7,7 @@ module GroupMe
8
7
  # @param group_id [String, Integer] Id of the group
9
8
  # @param text [String] Text of the message
10
9
  # @param attachments [Array<Hash>] Array of attachments
11
- def create_message(group_id, text, attachments=[])
10
+ def create_message(group_id, text, attachments = [])
12
11
  data = {
13
12
  :message => {
14
13
  :source_guid => Time.now.to_s,
@@ -35,7 +34,6 @@ module GroupMe
35
34
  def messages_count(group_id)
36
35
  get("/groups/#{group_id}/messages")['count']
37
36
  end
38
- alias :message_count :messages_count
39
-
37
+ alias_method :message_count, :messages_count
40
38
  end
41
39
  end
@@ -1,13 +1,11 @@
1
1
  module GroupMe
2
2
  module Users
3
-
4
3
  # Get details about the authenticated user
5
4
  #
6
5
  # @return [Hashie::Mash] Hash representing the user
7
6
  # @see https://dev.groupme.com/docs/v3#users_me
8
7
  def me
9
- get("/users/me")
8
+ get('/users/me')
10
9
  end
11
-
12
10
  end
13
- end
11
+ end
@@ -1,3 +1,3 @@
1
1
  module GroupMe
2
- VERSION = "0.0.5"
2
+ VERSION = '0.0.6'
3
3
  end
@@ -3,27 +3,60 @@ require 'spec_helper'
3
3
  describe GroupMe::Bots do
4
4
 
5
5
  before do
6
- @client = GroupMe::Client.new(:token => "TEST")
6
+ @client = GroupMe::Client.new(:token => 'TEST')
7
7
  end
8
8
 
9
- describe ".bots" do
9
+ describe '.bots' do
10
10
 
11
11
  it "returns user's bots" do
12
- stub_get("/bots").to_return(json_response("bots.json"))
12
+ stub_get('/bots').to_return(json_response('bots.json'))
13
13
  bots = @client.bots
14
- expect(bots.first.name).to eq("hal9000")
14
+ expect(bots.first.name).to eq('hal9000')
15
15
  end
16
16
 
17
17
  end
18
18
 
19
- describe ".bot" do
19
+ describe '.bot_post' do
20
20
 
21
- it "returns the matching bot" do
22
- stub_get("/bots/1234567890").to_return(json_response("bot.json"))
23
- bot = @client.bot(1234567890)
24
- expect(bot.name).to eq("hal9000")
21
+ it 'posts a message to a group' do
22
+ data = {
23
+ :bot_id => 1234567890,
24
+ :text => 'Test message'
25
+ }
26
+ stub_post('/bots/post', data).to_return(:status => 202, :body => ' ')
27
+ response = @client.bot_post(1234567890, 'Test message')
28
+ expect(response).to eq(true)
25
29
  end
26
30
 
27
31
  end
28
32
 
29
- end
33
+ describe '.create_bot' do
34
+
35
+ it 'creates a new bot' do
36
+ data = {
37
+ :bot => {
38
+ :name => 'hal9000',
39
+ :group_id => 1234567890
40
+ }
41
+ }
42
+ stub_post('/bots', data).to_return(json_response('bot.json', 201))
43
+ bot = @client.create_bot('hal9000', 1234567890)
44
+ expect(bot.name).to eq('hal9000')
45
+ end
46
+
47
+ end
48
+
49
+ describe '.destroy_bot' do
50
+
51
+ it 'destroys a bot' do
52
+ data = {
53
+ :bot_id => 1234567890
54
+ }
55
+ stub_post('/bots/destroy', data).to_return(:status => 200)
56
+ response = @client.destroy_bot(1234567890)
57
+ expect(response).to eq(true)
58
+ end
59
+
60
+ end
61
+
62
+ end
@@ -2,8 +2,8 @@ require 'spec_helper'
2
2
 
3
3
  describe GroupMe::Client do
4
4
 
5
- it "requires an access token" do
6
- expect{ GroupMe::Client.new }.to raise_error(ArgumentError)
5
+ it 'requires an access token' do
6
+ expect { GroupMe::Client.new }.to raise_error(ArgumentError)
7
7
  end
8
8
 
9
- end
9
+ end
@@ -3,83 +3,83 @@ require 'spec_helper'
3
3
  describe GroupMe::Groups do
4
4
 
5
5
  before do
6
- @client = GroupMe::Client.new(:token => "TEST")
6
+ @client = GroupMe::Client.new(:token => 'TEST')
7
7
  end
8
8
 
9
- describe ".groups" do
9
+ describe '.groups' do
10
10
 
11
11
  it "returns user's groups" do
12
- stub_get("/groups").to_return(json_response("groups.json"))
12
+ stub_get('/groups').to_return(json_response('groups.json'))
13
13
  groups = @client.groups
14
- expect(groups.first.name).to eq("Family")
14
+ expect(groups.first.name).to eq('Family')
15
15
  end
16
16
 
17
17
  end
18
18
 
19
- describe ".group" do
19
+ describe '.group' do
20
20
 
21
- it "returns the matching group" do
22
- stub_get("/groups/1234567890").to_return(json_response("group.json"))
21
+ it 'returns the matching group' do
22
+ stub_get('/groups/1234567890').to_return(json_response('group.json'))
23
23
  group = @client.group(1234567890)
24
- expect(group.name).to eq("Family")
24
+ expect(group.name).to eq('Family')
25
25
  end
26
26
 
27
27
  end
28
28
 
29
- describe ".former_groups" do
29
+ describe '.former_groups' do
30
30
 
31
31
  it "returns user's former groups" do
32
- stub_get("/groups/former").to_return(json_response("former_groups.json"))
32
+ stub_get('/groups/former').to_return(json_response('former_groups.json'))
33
33
  groups = @client.former_groups
34
- expect(groups.first.name).to eq("Previous Family")
34
+ expect(groups.first.name).to eq('Previous Family')
35
35
  end
36
36
 
37
37
  end
38
38
 
39
- describe ".create_group" do
39
+ describe '.create_group' do
40
40
 
41
- it "creates a group" do
42
- stub_post("/groups", {:name => "Family"}).to_return(json_response("group.json"))
43
- group = @client.create_group("Family")
44
- expect(group.name).to eq("Family")
41
+ it 'creates a group' do
42
+ stub_post('/groups', :name => 'Family').to_return(json_response('group.json'))
43
+ group = @client.create_group('Family')
44
+ expect(group.name).to eq('Family')
45
45
  end
46
46
 
47
47
  end
48
48
 
49
- describe ".update_group" do
49
+ describe '.update_group' do
50
50
 
51
- it "updates a group after creation" do
51
+ it 'updates a group after creation' do
52
52
  data = {
53
- :name => "Family",
53
+ :name => 'Family',
54
54
  :share => true,
55
- :image_url => "http://i.groupme.com/123456789"
55
+ :image_url => 'http://i.groupme.com/123456789'
56
56
  }
57
- stub_post("/groups/4321/update", data).to_return(json_response("updated_group.json"))
57
+ stub_post('/groups/4321/update', data).to_return(json_response('updated_group.json'))
58
58
  group = @client.update_group(4321, data)
59
- expect(group.name).to eq("Family")
60
- expect(group.share_url).to eq("https://groupme.com/join_group/1234567890/SHARE_TOKEN")
59
+ expect(group.name).to eq('Family')
60
+ expect(group.share_url).to eq('https://groupme.com/join_group/1234567890/SHARE_TOKEN')
61
61
  end
62
62
 
63
63
  end
64
64
 
65
- describe ".destroy_group" do
65
+ describe '.destroy_group' do
66
66
 
67
- it "disbands a group" do
68
- stub_post("/groups/4/destroy").to_return(:status => 200)
67
+ it 'disbands a group' do
68
+ stub_post('/groups/4/destroy').to_return(:status => 200)
69
69
  response = @client.destroy_group(4)
70
70
  expect(response).to eq(true)
71
71
  end
72
72
 
73
73
  end
74
74
 
75
- describe ".join_group" do
75
+ describe '.join_group' do
76
76
 
77
- it "joins a shared group" do
78
- stub_post("/groups/4/join/1234asdf").to_return(:status => 200)
77
+ it 'joins a shared group' do
78
+ stub_post('/groups/4/join/1234asdf').to_return(:status => 200)
79
79
  response = @client.join_group(4, '1234asdf')
80
80
  expect(response).to eq(true)
81
81
  end
82
82
 
83
83
  end
84
84
 
85
- end
85
+ end
@@ -3,27 +3,27 @@ require 'spec_helper'
3
3
  describe GroupMe::Likes do
4
4
 
5
5
  before do
6
- @client = GroupMe::Client.new(:token => "TEST")
6
+ @client = GroupMe::Client.new(:token => 'TEST')
7
7
  end
8
8
 
9
- describe ".create_like" do
9
+ describe '.create_like' do
10
10
 
11
- it "likes a message" do
12
- stub_post("/messages/3/5/like").to_return(:status => 200)
11
+ it 'likes a message' do
12
+ stub_post('/messages/3/5/like').to_return(:status => 200)
13
13
  response = @client.create_like(3, 5)
14
14
  expect(response).to eq(true)
15
15
  end
16
16
 
17
17
  end
18
18
 
19
- describe ".destroy_like" do
19
+ describe '.destroy_like' do
20
20
 
21
- it "likes a message" do
22
- stub_post("/messages/234/8/unlike").to_return(:status => 200)
21
+ it 'likes a message' do
22
+ stub_post('/messages/234/8/unlike').to_return(:status => 200)
23
23
  response = @client.destroy_like(234, 8)
24
24
  expect(response).to eq(true)
25
25
  end
26
26
 
27
27
  end
28
28
 
29
- end
29
+ end
@@ -3,18 +3,18 @@ require 'spec_helper'
3
3
  describe GroupMe::Members do
4
4
 
5
5
  before do
6
- @client = GroupMe::Client.new(:token => "TEST")
6
+ @client = GroupMe::Client.new(:token => 'TEST')
7
7
  end
8
8
 
9
- describe ".add_member" do
9
+ describe '.add_member' do
10
10
 
11
- it "adds a single member to a group" do
11
+ it 'adds a single member to a group' do
12
12
  member = {
13
- :nickname => "Mom",
14
- :user_id => "1234567890",
15
- :guid => "SOME_GUID"
13
+ :nickname => 'Mom',
14
+ :user_id => '1234567890',
15
+ :guid => 'SOME_GUID'
16
16
  }
17
- stub_post("/groups/1/members/add", [member]).to_return(:status => 202)
17
+ stub_post('/groups/1/members/add', [member]).to_return(:status => 202)
18
18
  response = @client.add_member(1, member)
19
19
  expect(response).to eq(true)
20
20
  end
@@ -33,23 +33,23 @@ describe GroupMe::Members do
33
33
 
34
34
  end
35
35
 
36
- describe ".add_members" do
36
+ describe '.add_members' do
37
37
 
38
- it "adds a list of members to a group" do
38
+ it 'adds a list of members to a group' do
39
39
  members = [{
40
- :nickname => "Mom",
41
- :user_id => "1234567890",
42
- :guid => "SOME_GUID"
43
- },{
44
- :nickname => "Dad",
45
- :phone_number => "+1 2123001234",
46
- :guid => "SOME_GUID"
47
- },{
48
- :nickname => "Jane",
49
- :email => "jane@example.com",
50
- :guid => "SOME_GUID"
40
+ :nickname => 'Mom',
41
+ :user_id => '1234567890',
42
+ :guid => 'SOME_GUID'
43
+ }, {
44
+ :nickname => 'Dad',
45
+ :phone_number => '+1 2123001234',
46
+ :guid => 'SOME_GUID'
47
+ }, {
48
+ :nickname => 'Jane',
49
+ :email => 'jane@example.com',
50
+ :guid => 'SOME_GUID'
51
51
  }]
52
- stub_post("/groups/1/members/add", members).to_return(:status => 202)
52
+ stub_post('/groups/1/members/add', members).to_return(:status => 202)
53
53
  response = @client.add_members(1, members)
54
54
  expect(response).to eq(true)
55
55
  end
@@ -59,11 +59,11 @@ describe GroupMe::Members do
59
59
  describe '.remove_member' do
60
60
 
61
61
  it 'removes a member from the group' do
62
- stub_post("/groups/1/members/234/remove").to_return(:status => 200)
62
+ stub_post('/groups/1/members/234/remove').to_return(:status => 200)
63
63
  response = @client.remove_member(1, 234)
64
64
  expect(response).to eq(true)
65
65
  end
66
66
 
67
67
  end
68
68
 
69
- end
69
+ end
@@ -5,29 +5,29 @@ require 'spec_helper'
5
5
  describe GroupMe::Messages do
6
6
 
7
7
  before do
8
- @client = GroupMe::Client.new(:token => "TEST")
8
+ @client = GroupMe::Client.new(:token => 'TEST')
9
9
  end
10
10
 
11
- describe ".message_count" do
11
+ describe '.message_count' do
12
12
 
13
- it "returns the number of messages for a group" do
14
- stub_get("/groups/1/messages").to_return(json_response("messages.json"))
13
+ it 'returns the number of messages for a group' do
14
+ stub_get('/groups/1/messages').to_return(json_response('messages.json'))
15
15
  expect(@client.message_count(1)).to eq(123)
16
16
  end
17
17
 
18
18
  end
19
19
 
20
- describe ".messages" do
20
+ describe '.messages' do
21
21
 
22
- it "returns messages for a group" do
23
- stub_get("/groups/1/messages").to_return(json_response("messages.json"))
22
+ it 'returns messages for a group' do
23
+ stub_get('/groups/1/messages').to_return(json_response('messages.json'))
24
24
  messages = @client.messages(1)
25
- expect(messages.first.text).to eq("Hello world ☃☃")
25
+ expect(messages.first.text).to eq('Hello world ☃☃')
26
26
  end
27
27
 
28
28
  end
29
29
 
30
- describe ".create_message" do
30
+ describe '.create_message' do
31
31
 
32
32
  before do
33
33
  Timecop.freeze(Time.new(2014, 10, 25, 22, 33, 44, 0000))
@@ -37,42 +37,42 @@ describe GroupMe::Messages do
37
37
  Timecop.return
38
38
  end
39
39
 
40
- it "sends a text only message to a group" do
40
+ it 'sends a text only message to a group' do
41
41
  message = {
42
42
  :message => {
43
43
  :source_guid => '2014-10-25 22:33:44 +0000',
44
- :text => "Hello world ☃☃",
44
+ :text => 'Hello world ☃☃'
45
45
  }
46
46
  }
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 ☃☃")
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 ☃☃')
50
50
  end
51
51
 
52
- it "sends a message with location to a group" do
52
+ it 'sends a message with location to a group' do
53
53
  message = {
54
54
  :message => {
55
55
  :source_guid => '2014-10-25 22:33:44 +0000',
56
- :text => "Hello world ☃☃",
56
+ :text => 'Hello world ☃☃',
57
57
  :attachments => [
58
58
  {
59
- :type => "location",
60
- :lat => "40.738206",
61
- :lng => "-73.993285",
62
- :name => "GroupMe HQ"
59
+ :type => 'location',
60
+ :lat => '40.738206',
61
+ :lng => '-73.993285',
62
+ :name => 'GroupMe HQ'
63
63
  }
64
64
  ]
65
65
  }
66
66
  }
67
- stub_post("/groups/1/messages", message).to_return(json_response("message_with_location.json", 201))
67
+ stub_post('/groups/1/messages', message).to_return(json_response('message_with_location.json', 201))
68
68
 
69
- att = { :type => "location", :lat => "40.738206", :lng => "-73.993285", :name => "GroupMe HQ" }
70
- message = @client.create_message(1, "Hello world ☃☃", [att])
71
- expect(message.text).to eq("Hello world ☃☃")
69
+ att = { :type => 'location', :lat => '40.738206', :lng => '-73.993285', :name => 'GroupMe HQ' }
70
+ message = @client.create_message(1, 'Hello world ☃☃', [att])
71
+ expect(message.text).to eq('Hello world ☃☃')
72
72
  expect(message.attachments.count).to eq(1)
73
- expect(message.attachments.first.type).to eq("location")
74
- expect(message.attachments.first.lat).to eq("40.738206")
75
- expect(message.attachments.first.lng).to eq("-73.993285")
73
+ expect(message.attachments.first.type).to eq('location')
74
+ expect(message.attachments.first.lat).to eq('40.738206')
75
+ expect(message.attachments.first.lng).to eq('-73.993285')
76
76
  end
77
77
 
78
78
  end
@@ -3,17 +3,17 @@ require 'spec_helper'
3
3
  describe GroupMe::Users do
4
4
 
5
5
  before do
6
- @client = GroupMe::Client.new(:token => "TEST")
6
+ @client = GroupMe::Client.new(:token => 'TEST')
7
7
  end
8
8
 
9
- describe ".me" do
9
+ describe '.me' do
10
10
 
11
- it "gets details about the authenticated user" do
12
- stub_get("/users/me").to_return(json_response("user.json"))
11
+ it 'gets details about the authenticated user' do
12
+ stub_get('/users/me').to_return(json_response('user.json'))
13
13
  response = @client.me
14
- expect(response.name).to eq("Ronald Swanson")
14
+ expect(response.name).to eq('Ronald Swanson')
15
15
  end
16
16
 
17
17
  end
18
18
 
19
- end
19
+ end
@@ -7,12 +7,12 @@ def stub_get(url)
7
7
  stub_request(:get, "https://api.groupme.com/v3#{url}")
8
8
  end
9
9
 
10
- def stub_post(url, data={})
10
+ def stub_post(url, data = {})
11
11
  stub_request(:post, "https://api.groupme.com/v3#{url}").with(:body => MultiJson.dump(data))
12
12
  end
13
13
 
14
14
  def fixture_path
15
- File.expand_path("../fixtures", __FILE__)
15
+ File.expand_path('../fixtures', __FILE__)
16
16
  end
17
17
 
18
18
  def fixture(file)
@@ -33,4 +33,4 @@ def json_response(file, status = 200)
33
33
  :content_type => 'application/json; charset=utf-8'
34
34
  }
35
35
  }
36
- end
36
+ end
metadata CHANGED
@@ -1,181 +1,195 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: groupme
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - David Radcliffe
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-10-27 00:00:00.000000000 Z
11
+ date: 2015-08-17 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
33
  version: '3.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
40
  version: '3.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
- version: '0'
47
+ version: 1.19.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
- version: '0'
54
+ version: 1.19.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
70
  name: pry
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
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
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: json
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ~>
87
+ - - "~>"
88
88
  - !ruby/object:Gem::Version
89
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
96
  version: '1.7'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: timecop
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ~>
101
+ - - "~>"
102
102
  - !ruby/object:Gem::Version
103
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
110
  version: '0.7'
111
+ - !ruby/object:Gem::Dependency
112
+ name: rubocop
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '0.33'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '0.33'
111
125
  - !ruby/object:Gem::Dependency
112
126
  name: faraday
113
127
  requirement: !ruby/object:Gem::Requirement
114
128
  requirements:
115
- - - ~>
129
+ - - "~>"
116
130
  - !ruby/object:Gem::Version
117
131
  version: 0.9.0
118
132
  type: :runtime
119
133
  prerelease: false
120
134
  version_requirements: !ruby/object:Gem::Requirement
121
135
  requirements:
122
- - - ~>
136
+ - - "~>"
123
137
  - !ruby/object:Gem::Version
124
138
  version: 0.9.0
125
139
  - !ruby/object:Gem::Dependency
126
140
  name: faraday_middleware
127
141
  requirement: !ruby/object:Gem::Requirement
128
142
  requirements:
129
- - - ~>
143
+ - - "~>"
130
144
  - !ruby/object:Gem::Version
131
145
  version: 0.9.0
132
146
  type: :runtime
133
147
  prerelease: false
134
148
  version_requirements: !ruby/object:Gem::Requirement
135
149
  requirements:
136
- - - ~>
150
+ - - "~>"
137
151
  - !ruby/object:Gem::Version
138
152
  version: 0.9.0
139
153
  - !ruby/object:Gem::Dependency
140
154
  name: hashie
141
155
  requirement: !ruby/object:Gem::Requirement
142
156
  requirements:
143
- - - ~>
157
+ - - "~>"
144
158
  - !ruby/object:Gem::Version
145
159
  version: '3.0'
146
160
  type: :runtime
147
161
  prerelease: false
148
162
  version_requirements: !ruby/object:Gem::Requirement
149
163
  requirements:
150
- - - ~>
164
+ - - "~>"
151
165
  - !ruby/object:Gem::Version
152
166
  version: '3.0'
153
167
  - !ruby/object:Gem::Dependency
154
168
  name: multi_json
155
169
  requirement: !ruby/object:Gem::Requirement
156
170
  requirements:
157
- - - ~>
171
+ - - "~>"
158
172
  - !ruby/object:Gem::Version
159
173
  version: '1.3'
160
174
  type: :runtime
161
175
  prerelease: false
162
176
  version_requirements: !ruby/object:Gem::Requirement
163
177
  requirements:
164
- - - ~>
178
+ - - "~>"
165
179
  - !ruby/object:Gem::Version
166
180
  version: '1.3'
167
181
  - !ruby/object:Gem::Dependency
168
182
  name: simple_oauth
169
183
  requirement: !ruby/object:Gem::Requirement
170
184
  requirements:
171
- - - ~>
185
+ - - "~>"
172
186
  - !ruby/object:Gem::Version
173
187
  version: '0.2'
174
188
  type: :runtime
175
189
  prerelease: false
176
190
  version_requirements: !ruby/object:Gem::Requirement
177
191
  requirements:
178
- - - ~>
192
+ - - "~>"
179
193
  - !ruby/object:Gem::Version
180
194
  version: '0.2'
181
195
  description: Simple wrapper for the GroupMe v3 API
@@ -185,10 +199,11 @@ executables: []
185
199
  extensions: []
186
200
  extra_rdoc_files: []
187
201
  files:
188
- - .gitignore
189
- - .pryrc
190
- - .rspec
191
- - .travis.yml
202
+ - ".gitignore"
203
+ - ".pryrc"
204
+ - ".rspec"
205
+ - ".rubocop.yml"
206
+ - ".travis.yml"
192
207
  - CONTRIBUTING.md
193
208
  - Gemfile
194
209
  - LICENSE.txt
@@ -234,17 +249,17 @@ require_paths:
234
249
  - lib
235
250
  required_ruby_version: !ruby/object:Gem::Requirement
236
251
  requirements:
237
- - - '>='
252
+ - - ">="
238
253
  - !ruby/object:Gem::Version
239
254
  version: '0'
240
255
  required_rubygems_version: !ruby/object:Gem::Requirement
241
256
  requirements:
242
- - - '>='
257
+ - - ">="
243
258
  - !ruby/object:Gem::Version
244
259
  version: '0'
245
260
  requirements: []
246
261
  rubyforge_project:
247
- rubygems_version: 2.0.14
262
+ rubygems_version: 2.4.8
248
263
  signing_key:
249
264
  specification_version: 4
250
265
  summary: Simple wrapper for the GroupMe v3 API