clashroyale 2.0.4 → 2.0.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9330c37af25e363f33dd73f289064780838f2464
4
- data.tar.gz: e6b88b4117a4f715725b8709dbe27da04550530e
3
+ metadata.gz: 37c27ed7c3138102892608c2cf1408a2a850bc0f
4
+ data.tar.gz: 46a651c1d5609daed0cc9fad36b23576bb5cf88a
5
5
  SHA512:
6
- metadata.gz: dd69d6f3daf86508d8ee04dce06d5e64bd409b0428ea44b8c44c906a7c7ca780c7e4469f106fd93d6397bf2b367e2aab58eb054f171ffb2ef86a90d7e2681802
7
- data.tar.gz: aab4a10dab3b30b313a8f3e25bb28d58f3dbe57212b5bafd3288b210deb56fdab833491003b9b2fc728737c849cc62240d038b1275454aef67ed9877ac1a543a
6
+ metadata.gz: 2c6c74b128c2bcb7d6f0ac55a3c2a4c81a052ada6bc3336c5c0fba8db58ff2b2e5cb038dad2411b3e044503213570b6f591bfe849b03c1ad658a8e197c0d57b0
7
+ data.tar.gz: e058cf7d996943ff6bc3794857196db8264ed2e7ca9d112fa8245eefed0115ee2127a56c03ca68b9db3afdc28a5a3d1f1b4c833bb8c2267ecf56631284195f57
@@ -6,10 +6,10 @@ require 'clashroyale/version'
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "clashroyale"
8
8
  spec.version = Clashroyale::VERSION
9
- spec.authors = ["Anderson da silva lima"]
9
+ spec.authors = ["Anderson Silva"]
10
10
  spec.email = ["sqacecadet@gmail.com"]
11
- spec.summary = %q{Ruby interface to Clash Royale API}
12
- spec.description = %q{Ruby interface to Clash Royale API}
11
+ spec.summary = %q{Ruby interface to Clash Royale API, www.clashroyale.xyz }
12
+ spec.description = %q{Ruby interface to Clash Royale API, www.clashroyale.xyz }
13
13
  spec.homepage = ""
14
14
  spec.license = "MIT"
15
15
 
@@ -23,6 +23,7 @@ Gem::Specification.new do |spec|
23
23
  spec.add_development_dependency "bundler", "~> 1.13"
24
24
  spec.add_development_dependency "rake", "~> 10.0"
25
25
  spec.add_development_dependency "rspec", "~> 3.0"
26
+ spec.add_development_dependency "byebug", "~> 9.0"
26
27
 
27
28
  spec.add_dependency "httparty", "~> 0.13.7"
28
29
  end
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Clash Royale Ruby Gem to connect to martincarrera's clash-royale-api https://github.com/martincarrera/clash-royale-api
1
+ # Ruby Gem to connect to [martincarrera's](https://github.com/martincarrera/clash-royale-api) [Clash Royale API](http://www.clashapi.xyz/)
2
2
 
3
3
  ## Installation
4
4
 
@@ -18,7 +18,7 @@ Or install it yourself as:
18
18
 
19
19
  Use this gem to get a inteface with Clash Royale API
20
20
  ```ruby
21
- clashdata = Deck.new
21
+ clashdata = ClashData.new
22
22
  clashdata.cards #Retrives a array of All Cards
23
23
  clashdata.chests #Retrives a array of All Cards
24
24
  clashdata.arenas #Retrives a array of All Cards
@@ -33,7 +33,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
33
33
 
34
34
  ## Contributing
35
35
 
36
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/clashroyale. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
36
+ Bug reports and pull requests are welcome on GitHub at https://github.com/andersonanderson/clashroyale. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
37
37
 
38
38
  ## License
39
39
 
@@ -1,29 +1,53 @@
1
1
  require 'clashroyale/version'
2
2
  require 'httparty'
3
+ require 'byebug'
3
4
 
4
5
  # Top module
5
6
  module Clashroyale
6
7
  include HTTParty
8
+ include Byebug
7
9
  end
8
10
 
9
- # Deck class
10
- class Chashdata
11
+ # Chashdata class
12
+ class Clashdata
11
13
  include Clashroyale
12
14
 
13
15
  attr_accessor :cards, :arenas, :chests, :players
14
- # base_uri = 'http://www.clashapi.xyz'
15
- # that hash has 4 others hashes
16
16
 
17
17
  def initialize
18
- self.players = fetch('players')
19
- self.chests = fetch('chests')
20
- self.arenas = fetch('arenas')
21
- self.cards = fetch('cards')
18
+ @players = []
19
+ @chests = []
20
+ @arenas = []
21
+ @cards = []
22
+ end
23
+
24
+ def cards
25
+ @cards = fetch('cards') if @cards.empty?
26
+ @cards
27
+ end
28
+
29
+ def chests
30
+ @chests = fetch('chests') if @chests.empty?
31
+ @chests
32
+ end
33
+
34
+ def players
35
+ @players = fetch('players') if @players.empty?
36
+ @players
37
+ end
38
+
39
+ def arenas
40
+ @arenas = fetch('arenas') if @arenas.empty?
41
+ @arenas
22
42
  end
23
43
 
24
44
  private
25
45
 
26
46
  def fetch(type)
27
- HTTParty.get("http://www.clashapi.xyz/api/#{type}", format: :json).parsed_response
47
+ begin
48
+ request = HTTParty.get("http://www.clashapi.xyz/api/#{type}", format: :json).parsed_response
49
+ rescue => e
50
+ puts "Rescued #{e.inspect}"
51
+ end
28
52
  end
29
53
  end
@@ -1,3 +1,3 @@
1
1
  module Clashroyale
2
- VERSION = "2.0.4"
2
+ VERSION = "2.0.5"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: clashroyale
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.4
4
+ version: 2.0.5
5
5
  platform: ruby
6
6
  authors:
7
- - Anderson da silva lima
7
+ - Anderson Silva
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-03-01 00:00:00.000000000 Z
11
+ date: 2017-03-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -52,6 +52,20 @@ dependencies:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '3.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: byebug
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '9.0'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '9.0'
55
69
  - !ruby/object:Gem::Dependency
56
70
  name: httparty
57
71
  requirement: !ruby/object:Gem::Requirement
@@ -66,7 +80,7 @@ dependencies:
66
80
  - - "~>"
67
81
  - !ruby/object:Gem::Version
68
82
  version: 0.13.7
69
- description: Ruby interface to Clash Royale API
83
+ description: 'Ruby interface to Clash Royale API, www.clashroyale.xyz '
70
84
  email:
71
85
  - sqacecadet@gmail.com
72
86
  executables: []
@@ -110,5 +124,5 @@ rubyforge_project:
110
124
  rubygems_version: 2.6.7
111
125
  signing_key:
112
126
  specification_version: 4
113
- summary: Ruby interface to Clash Royale API
127
+ summary: Ruby interface to Clash Royale API, www.clashroyale.xyz
114
128
  test_files: []