lol_static 0.0.1 → 0.0.2

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: b1e2382f9cbd4a4581c5aa955075bb833a12dfeb
4
- data.tar.gz: ed64056e1396e430a06375651dcbedd010c001b2
3
+ metadata.gz: 8654dbf815546d5c44aa264353e3d71bb8bebc22
4
+ data.tar.gz: 21ef93fbc5bef29daa50adc46d967128330c3b98
5
5
  SHA512:
6
- metadata.gz: 1138a424b4a2cc36adc162a7816543bbb9db3fd34d0d5c39df93a4dc6eed3ecf43f5677d6707803a9048eaab81f90337986e6c4abb73b452af65bea233279412
7
- data.tar.gz: 3e8bdfe54a872873d08a6827e02ecb61fc55a3ffc578eab7abd35b9077463883771e4074a99f2be13747f77212ef9d575d9f87bc494936604315fe60e12d90cb
6
+ metadata.gz: ca0f6cc05f68ad2315ca40f48e8723d736eb508bb784d83c36b31eb07ef2aae8db1db8426d5b54b359ac5007876355302dfaf2481057e717b18a5ba007bbac93
7
+ data.tar.gz: efbdd9a423409e07a6dd1ac8debc51d0db422dfc1a619e2a7074e2180cf951eb9f0e4ec6a8960e142413a2d1b38278910bd531fff9ae5e45b31f37b205cc8482
@@ -1,8 +1,10 @@
1
+ require 'lol_static'
2
+
1
3
  module LolStatic
2
4
  class Item
3
5
 
4
6
  def self.api_version
5
- @api_version ||= LolStatic.api_version('item')
7
+ LolStatic.api_version('item')
6
8
  end
7
9
 
8
10
  def initialize(item_id)
@@ -0,0 +1,21 @@
1
+ require 'httparty'
2
+
3
+ module LolStatic
4
+ class Realm
5
+
6
+ def base_uri
7
+ realm_data['cdn']
8
+ end
9
+
10
+ def api_version(name)
11
+ realm_data['n'][name.to_s]
12
+ end
13
+
14
+ private
15
+
16
+ def realm_data
17
+ @realm_data ||= HTTParty.get('http://ddragon.leagueoflegends.com/realms/euw.json').parsed_response
18
+ end
19
+
20
+ end
21
+ end
@@ -1,3 +1,3 @@
1
1
  module LolStatic
2
- VERSION = "0.0.1"
2
+ VERSION = '0.0.2'
3
3
  end
data/lib/lol_static.rb CHANGED
@@ -1,16 +1,15 @@
1
1
  require 'lol_static/version'
2
2
  require 'lol_static/item'
3
3
 
4
- require 'httparty'
5
4
 
6
5
  module LolStatic
7
6
  class << self
8
7
  def api_version(name)
9
- realm_data['n'][name.to_s]
8
+ realm.api_version(name)
10
9
  end
11
10
 
12
11
  def base_uri
13
- realm_data['cdn']
12
+ realm.base_uri
14
13
  end
15
14
 
16
15
  def item(id)
@@ -19,8 +18,9 @@ module LolStatic
19
18
 
20
19
  private
21
20
 
22
- def realm_data
23
- @realm_data ||= HTTParty.get('http://ddragon.leagueoflegends.com/realms/euw.json').parsed_response
21
+ def realm
22
+ @realm ||= Realm.new
24
23
  end
24
+
25
25
  end
26
26
  end
data/lol_static.gemspec CHANGED
@@ -4,23 +4,25 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
  require 'lol_static/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
- spec.name = "lol_static"
7
+ spec.name = 'lol_static'
8
8
  spec.version = LolStatic::VERSION
9
- spec.authors = ["Cameron Martin"]
10
- spec.email = ["cameronmartin123@gmail.com"]
9
+ spec.authors = ['Cameron Martin']
10
+ spec.email = ['cameronmartin123@gmail.com']
11
11
  spec.description = %q{Fetches static content from the league of legends CDN}
12
12
  spec.summary = spec.description
13
- spec.homepage = ""
14
- spec.license = "MIT"
13
+ spec.homepage = ''
14
+ spec.license = 'MIT'
15
15
 
16
16
  spec.files = `git ls-files`.split($/)
17
17
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_development_dependency "bundler", "~> 1.3"
22
- spec.add_development_dependency "rake"
23
- spec.add_development_dependency "rspec"
21
+ spec.add_development_dependency 'bundler', '~> 1.3'
22
+ spec.add_development_dependency 'rake'
23
+ spec.add_development_dependency 'rspec'
24
+ spec.add_development_dependency 'vcr'
25
+ spec.add_development_dependency 'webmock'
24
26
 
25
- spec.add_dependency "httparty"
27
+ spec.add_dependency 'httparty'
26
28
  end
@@ -0,0 +1,44 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://ddragon.leagueoflegends.com/realms/euw.json
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers: {}
10
+ response:
11
+ status:
12
+ code: 200
13
+ message: OK
14
+ headers:
15
+ Content-Type:
16
+ - text/json; charset=UTF-8
17
+ Content-Length:
18
+ - '287'
19
+ Connection:
20
+ - keep-alive
21
+ Date:
22
+ - Tue, 18 Mar 2014 19:02:15 GMT
23
+ Server:
24
+ - Apache/2.2.26 (Amazon)
25
+ X-Powered-By:
26
+ - PHP/5.3.18
27
+ Cache-Control:
28
+ - must-revalidate, no-cache, private
29
+ Etag:
30
+ - '"8b229376facbb4b06dba0935e277e2ef"'
31
+ X-Content-Digest:
32
+ - enebcc9881cfe14bc02f4656b03ece74e7e959aae5
33
+ X-Cache:
34
+ - RefreshHit from cloudfront
35
+ Via:
36
+ - 1.1 8792444549c943de8bc09305ff25b8fc.cloudfront.net (CloudFront)
37
+ X-Amz-Cf-Id:
38
+ - d77hEt6rmsx0x8YO8ggvoc7E5_SYU4khZ3TZ6v1YL_m6VO3LJceGHQ==
39
+ body:
40
+ encoding: UTF-8
41
+ string: '{"n":{"item":"4.4.3","rune":"4.2.6","mastery":"4.4.3","summoner":"4.4.3","champion":"4.4.3","profileicon":"4.4.3","language":"4.4.3"},"v":"4.4.3","l":"en_US","cdn":"http:\/\/ddragon.leagueoflegends.com\/cdn","dd":"4.2.6","lg":"0.152.55","css":"0.152.55","profileiconmax":28,"store":null}'
42
+ http_version:
43
+ recorded_at: Thu, 20 Mar 2014 13:35:58 GMT
44
+ recorded_with: VCR 2.8.0
@@ -0,0 +1,14 @@
1
+ require 'spec_helper'
2
+
3
+ require 'lol_static/item'
4
+
5
+ describe LolStatic::Item do
6
+ describe '#image_url' do
7
+ it 'returns image url' do
8
+ VCR.use_cassette('realm') do
9
+ item = LolStatic::Item.new(1)
10
+ expect(item.image_url).to eq('http://ddragon.leagueoflegends.com/cdn/4.4.3/img/item/1.png')
11
+ end
12
+ end
13
+ end
14
+ end
@@ -0,0 +1,23 @@
1
+ require 'spec_helper'
2
+
3
+ require 'lol_static/realm'
4
+
5
+ describe LolStatic::Realm do
6
+ describe '#base_uri' do
7
+ it 'returns correct uri' do
8
+ VCR.use_cassette('realm') do
9
+ realm = LolStatic::Realm.new
10
+ expect(realm.base_uri).to eq('http://ddragon.leagueoflegends.com/cdn')
11
+ end
12
+ end
13
+ end
14
+
15
+ describe '#api_version' do
16
+ it 'returns correct version for item' do
17
+ VCR.use_cassette('realm') do
18
+ realm = LolStatic::Realm.new
19
+ expect(realm.api_version('item')).to eq('4.4.3')
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,8 @@
1
+ require 'vcr'
2
+
3
+ ROOT_DIR = File.dirname(File.dirname(__FILE__))
4
+
5
+ VCR.configure do |c|
6
+ c.cassette_library_dir = File.join(ROOT_DIR, 'spec', 'fixtures')
7
+ c.hook_into :webmock # or :fakeweb
8
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lol_static
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cameron Martin
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-19 00:00:00.000000000 Z
11
+ date: 2014-03-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -52,6 +52,34 @@ dependencies:
52
52
  - - '>='
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: vcr
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: webmock
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - '>='
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - '>='
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
55
83
  - !ruby/object:Gem::Dependency
56
84
  name: httparty
57
85
  requirement: !ruby/object:Gem::Requirement
@@ -80,9 +108,13 @@ files:
80
108
  - Rakefile
81
109
  - lib/lol_static.rb
82
110
  - lib/lol_static/item.rb
111
+ - lib/lol_static/realm.rb
83
112
  - lib/lol_static/version.rb
84
113
  - lol_static.gemspec
85
- - spec/item_spec.rb
114
+ - spec/fixtures/realm.yml
115
+ - spec/lol_static/item_spec.rb
116
+ - spec/lol_static/realm_spec.rb
117
+ - spec/spec_helper.rb
86
118
  homepage: ''
87
119
  licenses:
88
120
  - MIT
@@ -108,4 +140,8 @@ signing_key:
108
140
  specification_version: 4
109
141
  summary: Fetches static content from the league of legends CDN
110
142
  test_files:
111
- - spec/item_spec.rb
143
+ - spec/fixtures/realm.yml
144
+ - spec/lol_static/item_spec.rb
145
+ - spec/lol_static/realm_spec.rb
146
+ - spec/spec_helper.rb
147
+ has_rdoc:
data/spec/item_spec.rb DELETED
@@ -1,16 +0,0 @@
1
- require 'lol_static'
2
-
3
- describe LolStatic::Item do
4
- describe '.api_version' do
5
- it 'returns an api version' do
6
- expect(LolStatic::Item.api_version).to match(/^(?:\d+.)*\d+$/)
7
- end
8
- end
9
-
10
- describe '#image_url' do
11
- it 'returns image url' do
12
- item = LolStatic::Item.new(1)
13
- expect(item.image_url).to eq('http://ddragon.leagueoflegends.com/cdn/4.4.3/img/item/1.png')
14
- end
15
- end
16
- end