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 +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +24 -5
- data/lib/clashinator/exceptions/response_error.rb +5 -5
- data/lib/clashinator/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 237e6890b9e9d6645c7908ea43fee68831d88a9c
|
4
|
+
data.tar.gz: 539ec575c05a83d7bbadd1dc00eb3e4f966ee5d4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c926386fbce2b6cc200799ce764eb42557aa8741ed7d5a51a23e600b457f3bcfa038702a7d8552db74d178c56a07600804f993db86c15e0cb8fe5a25dc650607
|
7
|
+
data.tar.gz: 44fa2ba2b94ba03e9b10cd00d3b6ca6426838f192e5735f25ff98e2f3847ab8d0a9c3ceb90bb38b71882e07c615395847af86a58651e52a75830a6f06da0ff8d
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
# Clashinator
|
2
2
|
|
3
|
-
|
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
|
-
|
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/
|
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
|
-
|
12
|
-
|
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,
|
25
|
+
{ error_code: response.status, reason: response.body.reason }
|
26
26
|
end
|
27
27
|
end
|
28
28
|
end
|
data/lib/clashinator/version.rb
CHANGED