clashinator 0.1.0 → 0.1.2

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: 10b71b1313b2e9eab1c142bdb52b9ece293d75c9
4
- data.tar.gz: 9b1bd1dfa94569ac0be33f477c783c148d2d1562
3
+ metadata.gz: 237e6890b9e9d6645c7908ea43fee68831d88a9c
4
+ data.tar.gz: 539ec575c05a83d7bbadd1dc00eb3e4f966ee5d4
5
5
  SHA512:
6
- metadata.gz: 553867236c9c2ab15fd15b77596751f5b704e782faacfbcb3359fda132262cc409d35ef77cd223123ffe2be3e9fc336088ddd6689c65a781f86f15c801a8d455
7
- data.tar.gz: e9d70df33652c36ef7795dbee62496cda19a4fefdaf2d682c900cde2685bb23f50499fafe057cbe7c320d4fd21aa056d3ee88e43665448b4828b78de2ed5b4f1
6
+ metadata.gz: c926386fbce2b6cc200799ce764eb42557aa8741ed7d5a51a23e600b457f3bcfa038702a7d8552db74d178c56a07600804f993db86c15e0cb8fe5a25dc650607
7
+ data.tar.gz: 44fa2ba2b94ba03e9b10cd00d3b6ca6426838f192e5735f25ff98e2f3847ab8d0a9c3ceb90bb38b71882e07c615395847af86a58651e52a75830a6f06da0ff8d
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- clashinator (0.1.0)
4
+ clashinator (0.1.2)
5
5
  faraday (~> 0.9.2)
6
6
  faraday_middleware (~> 0.10)
7
7
 
data/README.md CHANGED
@@ -1,8 +1,6 @@
1
1
  # Clashinator
2
2
 
3
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/clashinator`. To experiment with that code, run `bin/console` for an interactive prompt.
4
-
5
- TODO: Delete this and the text above, and describe your gem
3
+ Ruby wrapper for the Clash of Clans API
6
4
 
7
5
  ## Installation
8
6
 
@@ -22,7 +20,28 @@ Or install it yourself as:
22
20
 
23
21
  ## Usage
24
22
 
25
- TODO: Write usage instructions here
23
+ You'll need to generate an access token in Clash of Clans developer page at:
24
+ [https://developer.clashofclans.com](https://developer.clashofclans.com)
25
+
26
+ With your access token, retrieve a client instance with it.
27
+
28
+ `client = Clashinator::Client.new('YOUR TOKEN')`
29
+
30
+ To retrieve objects(for now JSON data), you can perform this actions, defined in the Clash of Clans API docs:
31
+
32
+ ```ruby
33
+ client.find_clan({name: 'onehive', minMembers: 25})
34
+
35
+ client.get_clan_info({clan_tag: '#2U2CYPQ8'})
36
+
37
+ client.list_clan_members({clan_tag: '#2U2CYPQ8'})
38
+
39
+ client.list_locations()
40
+
41
+ client.get_location_info({location_id: 32000254})
42
+
43
+ client.get_ranking_for_location({location_id: 32000254, ranking_id: 'clans'})
44
+ ```
26
45
 
27
46
  ## Development
28
47
 
@@ -32,7 +51,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
32
51
 
33
52
  ## Contributing
34
53
 
35
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/clashinator. 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.
54
+ Bug reports and pull requests are welcome on GitHub at https://github.com/leocabeza/clashinator. 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
55
 
37
56
 
38
57
  ## License
@@ -7,10 +7,10 @@ module Clashinator
7
7
  @response = response
8
8
  end
9
9
 
10
- def to_s
11
- super +
12
- format(' (%s)', data.map { |k, v| %(#{k}: "#{v}") }.join(', '))
13
- end
10
+ #def to_s
11
+ # super +
12
+ # format(' (%s)', data.map { |k, v| %(#{k}: "#{v}") }.join(', '))
13
+ #end
14
14
 
15
15
  #def error_code
16
16
  # data[:error_code] || data['error_code']
@@ -22,7 +22,7 @@ module Clashinator
22
22
  @data ||= begin
23
23
  JSON.parse(response.body)
24
24
  rescue JSON::ParserError
25
- { error_code: response.status, uri: response.env.url.to_s }
25
+ { error_code: response.status, reason: response.body.reason }
26
26
  end
27
27
  end
28
28
  end
@@ -1,3 +1,3 @@
1
1
  module Clashinator
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: clashinator
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Leonardo Cabeza