destiny_rb 0.1.1 → 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/README.md +12 -7
- data/lib/destiny_rb/manifest.rb +13 -0
- data/lib/destiny_rb/manifest_definitions.rb +26 -18
- data/lib/destiny_rb/vendors.rb +1 -1
- data/lib/destiny_rb/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 86b7e316cba77554d4145e6b8b5613a6ed75d49b
|
4
|
+
data.tar.gz: 098f229c82c3c591a06ebd381a639e4cdf65472d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 21ac286d930b814ac7c12dc2ce5a6e91102de700d858e361de35c88d3bffb33c515edc8c1db99a2ebc46c338114dd54cc9f6d18b945132212bc1c99ad53e331e
|
7
|
+
data.tar.gz: 164d6cf51f66f0bc5acd9ac736469d44c0b7d52f105adaf28098462f8f43837d27454a731f7b9dc94b594b665c96d78b8dcfedaf4eb4bb87b0f001e061a67740
|
data/README.md
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
# DestinyRb
|
2
2
|
|
3
|
-
Welcome to
|
3
|
+
Welcome to Destiny_rb! This is a lightweight Ruby wrapper for Bungies Destiny API. Currently it is only focused on anonymous API calls, so no endpoints that require a XBL/PSN sign-in will be supported. More to come on that in the future!
|
4
4
|
|
5
|
-
|
5
|
+
If you are a Slack user feel free to check out [lita-destiny], a Lita handler that spawned this gem!
|
6
6
|
|
7
7
|
## Installation
|
8
8
|
|
@@ -22,20 +22,25 @@ Or install it yourself as:
|
|
22
22
|
|
23
23
|
## Usage
|
24
24
|
|
25
|
-
|
25
|
+
Please refer to the [documentation].
|
26
26
|
|
27
27
|
## Development
|
28
28
|
|
29
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake
|
29
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
30
30
|
|
31
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org]
|
31
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org].
|
32
32
|
|
33
33
|
## Contributing
|
34
34
|
|
35
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
35
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/PDaily/destiny_rb. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the code of conduct.
|
36
36
|
|
37
37
|
|
38
38
|
## License
|
39
39
|
|
40
|
-
The gem is available as open source under the terms of the [MIT License]
|
40
|
+
The gem is available as open source under the terms of the [MIT License].
|
41
41
|
|
42
|
+
[lita-destiny]:https://github.com/PDaily/lita-destiny
|
43
|
+
[documentation]:http://www.rubydoc.info/gems/destiny_rb
|
44
|
+
[Contributor Covenant]:http://contributor-covenant.org/
|
45
|
+
[rubygems.org]:https://rubygems.org
|
46
|
+
[MIT License]:http://opensource.org/licenses/MIT
|
data/lib/destiny_rb/manifest.rb
CHANGED
@@ -1,6 +1,19 @@
|
|
1
1
|
module Destiny
|
2
2
|
module Manifest
|
3
3
|
|
4
|
+
def search_destiny_player(player_name, platform_type)
|
5
|
+
raw_data = self.class.get("/SearchDestinyPlayer/#{platform_type}/#{player_name}/").parsed_response['Response']['membershipId']
|
6
|
+
end
|
7
|
+
|
8
|
+
def get_destiny_account(player_name, platform_type)
|
9
|
+
member_id = self.search_destiny_player(player_name, platform_type)
|
10
|
+
raw_data = self.class.get("/#{platform_type}/Account/#{member_id}/").parsed_response['Response']['data']
|
11
|
+
end
|
12
|
+
|
13
|
+
def get_manifest_item(type_id, item_id)
|
14
|
+
raw_data = self.class.get("/Manifest/#{type_id}/#{item_id}").parsed_response['Response']['data']['inventoryItem']
|
15
|
+
end
|
16
|
+
|
4
17
|
# GET information about a place, specifically a planet.
|
5
18
|
#
|
6
19
|
# Usage:
|
@@ -4,6 +4,26 @@ module Destiny
|
|
4
4
|
# http://www.bungie.net/Platform/Destiny/Manifest/
|
5
5
|
module ManifestDefinitions
|
6
6
|
|
7
|
+
# Type Checker Helper Method
|
8
|
+
#
|
9
|
+
# Usage:
|
10
|
+
# type_checker(type, hash)
|
11
|
+
#
|
12
|
+
# Arguments:
|
13
|
+
# type: (String/Symbol)
|
14
|
+
# hash: (Ruby Hash)
|
15
|
+
#
|
16
|
+
# Returns:
|
17
|
+
# Either a numberic value or symbol extracted from a source hash depending on what type was supplied.
|
18
|
+
#
|
19
|
+
def type_checker(type, hash)
|
20
|
+
if type.is_a? Numeric
|
21
|
+
requested_type = hash.key(type) || :none# Fetch type from hash, if type doesn't match return 'none'
|
22
|
+
else type.is_a? Symbol
|
23
|
+
requested_type = hash.fetch(type, 0) # Fetch type from hash, if type doesn't match return 0 for 'none'
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
7
27
|
# Character Class definitions
|
8
28
|
#
|
9
29
|
# Usage:
|
@@ -17,17 +37,13 @@ module Destiny
|
|
17
37
|
# Either the numeric representation of a character class or a symbol of said class.
|
18
38
|
#
|
19
39
|
def character_class(type)
|
20
|
-
|
40
|
+
classes = {
|
21
41
|
titan: 0,
|
22
42
|
hunter: 1,
|
23
43
|
warlock: 2,
|
24
44
|
unknown: 3
|
25
45
|
}
|
26
|
-
|
27
|
-
requested_type = types.key(type) || :none# Fetch type from hash, if type doesn't match return 'none'
|
28
|
-
else type.is_a? Symbol
|
29
|
-
requested_type = types.fetch(type, 0) # Fetch type from hash, if type doesn't match return 0 for 'none'
|
30
|
-
end
|
46
|
+
type_checker(type, classes)
|
31
47
|
end
|
32
48
|
|
33
49
|
# Enemy Race definitions
|
@@ -42,18 +58,14 @@ module Destiny
|
|
42
58
|
# Returns:
|
43
59
|
# Either the numeric representation of a enemy race or a symbol of said race.
|
44
60
|
def enemy_race(type)
|
45
|
-
|
61
|
+
races = {
|
46
62
|
none: 0, # Not a real Bungie value
|
47
63
|
fallen: 1636291695,
|
48
64
|
vex: 711470098,
|
49
65
|
cabal: 546070638,
|
50
66
|
hive: 3265589059
|
51
67
|
}
|
52
|
-
|
53
|
-
requested_type = types.key(type) || :none# Fetch type from hash, if type doesn't match return 'none'
|
54
|
-
else type.is_a? Symbol
|
55
|
-
requested_type = types.fetch(type, 0) # Fetch type from hash, if type doesn't match return 0 for 'none'
|
56
|
-
end
|
68
|
+
type_checker(type, races)
|
57
69
|
end
|
58
70
|
|
59
71
|
# Skull (modifier) definitions
|
@@ -68,7 +80,7 @@ module Destiny
|
|
68
80
|
# Returns:
|
69
81
|
# Either the numeric representation of a skull or a symbol of said skull.
|
70
82
|
def skulls(type)
|
71
|
-
|
83
|
+
skulls = {
|
72
84
|
none: 0, # Not a real Bungie value
|
73
85
|
trickle: 1,
|
74
86
|
grounded: 2,
|
@@ -86,11 +98,7 @@ module Destiny
|
|
86
98
|
lightswitch: 19,
|
87
99
|
melee_damage_boost: 20
|
88
100
|
}
|
89
|
-
|
90
|
-
requested_type = types.key(type) || :none# Fetch type from hash, if type doesn't match return 'none'
|
91
|
-
else type.is_a? Symbol
|
92
|
-
requested_type = types.fetch(type, 0) # Fetch type from hash, if type doesn't match return 0 for 'none'
|
93
|
-
end
|
101
|
+
type_checker(type, skulls)
|
94
102
|
end
|
95
103
|
|
96
104
|
end
|
data/lib/destiny_rb/vendors.rb
CHANGED
data/lib/destiny_rb/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: destiny_rb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- pDaily
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-08-
|
11
|
+
date: 2015-08-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|