-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2 from nicolaracco/game_request
Completed Game request and refactored specs
- Loading branch information
Showing
14 changed files
with
244 additions
and
125 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
require 'active_support/core_ext/string/inflections' | ||
|
||
module Lol | ||
class Model | ||
# Initializes a Lol::Model | ||
# @param options [Hash] | ||
# @return [Lol::Model] | ||
def initialize options = {} | ||
@raw = options | ||
options.each do |attribute_name, value| | ||
send "#{attribute_name.to_s.underscore}=", value | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
require 'lol/model' | ||
|
||
module Lol | ||
class Player < Lol::Model | ||
# @!attribute [r] raw | ||
# @return [Hash] raw version of options Hash used to initialize Player | ||
attr_reader :raw | ||
|
||
# @!attribute [r] champion_id | ||
# @return [Fixnum] Champion Id associated with player | ||
attr_reader :champion_id | ||
|
||
# @!attribute [r] summoner_id | ||
# @return [Fixnum] Summoner Id associated with player | ||
attr_reader :summoner_id | ||
|
||
# @!attribute [r] team_id | ||
# @return [Fixnum] Team Id associated with player | ||
attr_reader :team_id | ||
|
||
private | ||
|
||
attr_writer :champion_id, :summoner_id, :team_id | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
require 'lol/model' | ||
|
||
module Lol | ||
class Statistic < Lol::Model | ||
# @!attribute [r] raw | ||
# @return [Hash] raw version of options Hash used to initialize Statistic | ||
attr_reader :raw | ||
|
||
# @!attribute [r] id | ||
# @return [Fixnum] Raw Statistic Id | ||
attr_reader :id | ||
|
||
# @!attribute [r] name | ||
# @return [String] Raw Statistic name | ||
attr_reader :name | ||
|
||
# @!attribute [r] value | ||
# @return [Fixnum] Raw Statistic value | ||
attr_reader :value | ||
|
||
private | ||
|
||
attr_writer :id, :name, :value | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
require "lol" | ||
require "spec_helper" | ||
|
||
include Lol | ||
|
||
describe Player do | ||
it_behaves_like 'Lol model' do | ||
let(:valid_attributes) { { team_id: 1 } } | ||
end | ||
|
||
%w(champion_id summoner_id team_id).each do |attribute| | ||
describe "#{attribute} attribute" do | ||
it_behaves_like 'plain attribute' do | ||
let(:attribute) { attribute } | ||
let(:attribute_value) { 'asd' } | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
require "lol" | ||
require "spec_helper" | ||
|
||
include Lol | ||
|
||
describe Statistic do | ||
it_behaves_like 'Lol model' do | ||
let(:valid_attributes) { { id: 1 } } | ||
end | ||
|
||
%w(id name value).each do |attribute| | ||
describe "#{attribute} attribute" do | ||
it_behaves_like 'plain attribute' do | ||
let(:attribute) { attribute } | ||
let(:attribute_value) { 'asd' } | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.