mousecop 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +17 -0
- data/Gemfile +4 -0
- data/Guardfile +28 -0
- data/LICENSE.txt +22 -0
- data/README.md +33 -0
- data/Rakefile +1 -0
- data/lib/mousecop.rb +6 -0
- data/lib/mousecop/player.rb +43 -0
- data/lib/mousecop/version.rb +3 -0
- data/mousecop.gemspec +26 -0
- data/test/mousecop/player_test.rb +29 -0
- data/test/test_helper.rb +2 -0
- metadata +129 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 8b15413cea7a3b248389904abaa336e5d833b306
|
4
|
+
data.tar.gz: a3f74989607dea2a128e5523a5ff1d4f10b59159
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: c0e92bd47f3c304e1f9a5be9ddfe7a9d503c61cb7152f8bededfda720dd97f31450f94db3930be29edbe3ba5df9f4d740f216145276c36ec9909c509835967a4
|
7
|
+
data.tar.gz: 3ba0418872df84591ce8dd3fb233d9d9bd91b6fba1251174e092a79702f7f26f284d0206f4d440a7e11df561e45ad2f5c19ff79482b7512c57ea2d2abda66d36
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/Guardfile
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# A sample Guardfile
|
2
|
+
# More info at https://github.com/guard/guard#readme
|
3
|
+
|
4
|
+
guard :minitest do
|
5
|
+
# with Minitest::Unit
|
6
|
+
watch(%r{^test/(.*)\/?test_(.*)\.rb})
|
7
|
+
watch(%r{^lib/(.*/)?([^/]+)\.rb}) { |m| "test/#{m[1]}test_#{m[2]}.rb" }
|
8
|
+
watch(%r{^test/test_helper\.rb}) { 'test' }
|
9
|
+
|
10
|
+
# with Minitest::Spec
|
11
|
+
# watch(%r{^spec/(.*)_spec\.rb})
|
12
|
+
# watch(%r{^lib/(.+)\.rb}) { |m| "spec/#{m[1]}_spec.rb" }
|
13
|
+
# watch(%r{^spec/spec_helper\.rb}) { 'spec' }
|
14
|
+
|
15
|
+
# Rails 4
|
16
|
+
# watch(%r{^app/(.+)\.rb}) { |m| "test/#{m[1]}_test.rb" }
|
17
|
+
# watch(%r{^app/controllers/application_controller\.rb}) { 'test/controllers' }
|
18
|
+
# watch(%r{^app/controllers/(.+)_controller\.rb}) { |m| "test/integration/#{m[1]}_test.rb" }
|
19
|
+
# watch(%r{^app/views/(.+)_mailer/.+}) { |m| "test/mailers/#{m[1]}_mailer_test.rb" }
|
20
|
+
# watch(%r{^lib/(.+)\.rb}) { |m| "test/lib/#{m[1]}_test.rb" }
|
21
|
+
# watch(%r{^test/.+_test\.rb})
|
22
|
+
# watch(%r{^test/test_helper\.rb}) { 'test' }
|
23
|
+
|
24
|
+
# Rails < 4
|
25
|
+
# watch(%r{^app/controllers/(.*)\.rb}) { |m| "test/functional/#{m[1]}_test.rb" }
|
26
|
+
# watch(%r{^app/helpers/(.*)\.rb}) { |m| "test/helpers/#{m[1]}_test.rb" }
|
27
|
+
# watch(%r{^app/models/(.*)\.rb}) { |m| "test/unit/#{m[1]}_test.rb" }
|
28
|
+
end
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Rolen Le
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# Mousecop
|
2
|
+
|
3
|
+
Ruby gem wrapper for http://collegebowl.avatarpro.biz/
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'mousecop'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install mousecop
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
Setting up:
|
22
|
+
|
23
|
+
$ Mousecop::Player.all #=> return all
|
24
|
+
$ Mousecop::Player.sample #=> returns random player
|
25
|
+
|
26
|
+
|
27
|
+
## Contributing
|
28
|
+
|
29
|
+
1. Fork it
|
30
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
31
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
32
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
33
|
+
5. Create new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
data/lib/mousecop.rb
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'json'
|
2
|
+
require 'faraday'
|
3
|
+
|
4
|
+
module Mousecop
|
5
|
+
class Player
|
6
|
+
attr_accessor :name, :id, :image, :conference
|
7
|
+
|
8
|
+
def self.all
|
9
|
+
@roster = Faraday.get(base_url + "/players").body
|
10
|
+
|
11
|
+
JSON.parse(@roster).collect do |player|
|
12
|
+
self.create(name: player["name"],
|
13
|
+
id: player["id"],
|
14
|
+
image: player["image"])
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.create(attributes= {})
|
19
|
+
self.new.tap do |player|
|
20
|
+
player.name = attributes[:name]
|
21
|
+
player.id = attributes[:id]
|
22
|
+
player.image = attributes[:image]
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.sample
|
27
|
+
player_response = Faraday.get(base_url + "/player").body
|
28
|
+
player = JSON.parse(player_response).first
|
29
|
+
Mousecop::Player.create(name: player["name"],
|
30
|
+
id: player["id"],
|
31
|
+
image: player["image"])
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.first
|
35
|
+
@all ||= self.all
|
36
|
+
@all.first
|
37
|
+
end
|
38
|
+
|
39
|
+
def self.base_url
|
40
|
+
"http://collegebowl.avatarpro.biz/"
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
data/mousecop.gemspec
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'mousecop/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "mousecop"
|
8
|
+
spec.version = Mousecop::VERSION
|
9
|
+
spec.authors = ["Rolen Le"]
|
10
|
+
spec.email = ["rolentle@gmail.com"]
|
11
|
+
spec.description = "A Ruby Gem Wrapper for A Flamboyant Mock User Generator"
|
12
|
+
spec.summary = "This is a Ruby Gem Wrapper for A Flamboyant Mock User Generator found at http://collegebowl.avatarpro.biz/"
|
13
|
+
spec.homepage = "https://github.com/rolentle/mousecop"
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
spec.add_development_dependency "guard"
|
24
|
+
spec.add_development_dependency "guard-minitest"
|
25
|
+
spec.add_runtime_dependency "faraday"
|
26
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
class PlayerTest < MiniTest::Test
|
4
|
+
|
5
|
+
def test_player_all_returns_all_players
|
6
|
+
Mousecop::Player.all.each do |player|
|
7
|
+
assert_kind_of Mousecop::Player, player
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def test_player_can_create_with_attributes
|
12
|
+
player = Mousecop::Player.create(name: "bob",
|
13
|
+
id: "d41d8cd98f00b204e9800998ecf8427e",
|
14
|
+
image: "http://collegebowl.avatarpro.biz/images/d41d8cd98f00b204e9800998ecf8427e" )
|
15
|
+
assert_equal "bob", player.name
|
16
|
+
assert_equal "d41d8cd98f00b204e9800998ecf8427e", player.id
|
17
|
+
assert_equal "http://collegebowl.avatarpro.biz/images/d41d8cd98f00b204e9800998ecf8427e", player.image
|
18
|
+
end
|
19
|
+
|
20
|
+
def test_sample_returns_random_player
|
21
|
+
player1 = Mousecop::Player.sample
|
22
|
+
player2 = Mousecop::Player.sample
|
23
|
+
refute_equal player1.name, player2.name
|
24
|
+
end
|
25
|
+
|
26
|
+
def test_return_players_first
|
27
|
+
assert_kind_of Mousecop::Player, Mousecop::Player.first
|
28
|
+
end
|
29
|
+
end
|
data/test/test_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,129 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: mousecop
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Rolen Le
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-01-12 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ~>
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.3'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ~>
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: guard
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - '>='
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: guard-minitest
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - '>='
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: faraday
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - '>='
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :runtime
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - '>='
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
description: A Ruby Gem Wrapper for A Flamboyant Mock User Generator
|
84
|
+
email:
|
85
|
+
- rolentle@gmail.com
|
86
|
+
executables: []
|
87
|
+
extensions: []
|
88
|
+
extra_rdoc_files: []
|
89
|
+
files:
|
90
|
+
- .gitignore
|
91
|
+
- Gemfile
|
92
|
+
- Guardfile
|
93
|
+
- LICENSE.txt
|
94
|
+
- README.md
|
95
|
+
- Rakefile
|
96
|
+
- lib/mousecop.rb
|
97
|
+
- lib/mousecop/player.rb
|
98
|
+
- lib/mousecop/version.rb
|
99
|
+
- mousecop.gemspec
|
100
|
+
- test/mousecop/player_test.rb
|
101
|
+
- test/test_helper.rb
|
102
|
+
homepage: https://github.com/rolentle/mousecop
|
103
|
+
licenses:
|
104
|
+
- MIT
|
105
|
+
metadata: {}
|
106
|
+
post_install_message:
|
107
|
+
rdoc_options: []
|
108
|
+
require_paths:
|
109
|
+
- lib
|
110
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
111
|
+
requirements:
|
112
|
+
- - '>='
|
113
|
+
- !ruby/object:Gem::Version
|
114
|
+
version: '0'
|
115
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
116
|
+
requirements:
|
117
|
+
- - '>='
|
118
|
+
- !ruby/object:Gem::Version
|
119
|
+
version: '0'
|
120
|
+
requirements: []
|
121
|
+
rubyforge_project:
|
122
|
+
rubygems_version: 2.1.11
|
123
|
+
signing_key:
|
124
|
+
specification_version: 4
|
125
|
+
summary: This is a Ruby Gem Wrapper for A Flamboyant Mock User Generator found at
|
126
|
+
http://collegebowl.avatarpro.biz/
|
127
|
+
test_files:
|
128
|
+
- test/mousecop/player_test.rb
|
129
|
+
- test/test_helper.rb
|