lita-destiny 0.1.4 → 0.2.0
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 +0 -47
- data/lib/lita-destiny.rb +1 -1
- data/lita-destiny.gemspec +3 -3
- metadata +6 -13
- data/lib/destiny/base_api.rb +0 -169
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 99ea47e27f80fe3f59b2066e75e90241ca8732de
|
4
|
+
data.tar.gz: c444142a09b63132d63148454f7287fdae3ade2f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6548499bef7ecc6ecdcd4ccecc5acfbd9e135bc04a2a3f18b930f760e5493b6c973ac933bff13e6baf937656cbf4d2cb41c9f3dc74d295c2c41666daa404f8d0
|
7
|
+
data.tar.gz: 318e1177eecb42d1d07b5aae43eb517b819790dc4a0b5c04bcc04622d6c9ebc8dfa811d7e087d47ca3278e0490c26ae0830508b57888e1680b19ac0fc44744be
|
data/README.md
CHANGED
@@ -25,50 +25,3 @@ config.handlers.destiny.api_key = 'XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
|
|
25
25
|
## Usage
|
26
26
|
|
27
27
|
This gem adds several methods for chat routes.
|
28
|
-
|
29
|
-
|
30
|
-
##### #advisors
|
31
|
-
> Returns a hash object containing the days advisor report
|
32
|
-
> For brevity, see http://www.bungie.net/Platform/Destiny/Advisors/
|
33
|
-
|
34
|
-
#### #activity(activity_hash, raw=false)
|
35
|
-
> Two options: *raw data* as returned by Bungies server or *parsed data* as manipulated by the method.
|
36
|
-
>
|
37
|
-
> Defaults to *parsed data*, but can be overridden by passing ```true``` as the second argument.
|
38
|
-
|
39
|
-
##### #nightfall(options={})
|
40
|
-
> Returns a hash object from #activity
|
41
|
-
```
|
42
|
-
{ activityName: raw_data['activityName'],
|
43
|
-
activityDescription: raw_data['activityDescription'],
|
44
|
-
skulls: skulls }
|
45
|
-
```
|
46
|
-
##### #weekly_strike(options={})
|
47
|
-
> Returns a hash object
|
48
|
-
```
|
49
|
-
{ activityName: raw_data['activityName'],
|
50
|
-
activityDescription: raw_data['activityDescription'],
|
51
|
-
skulls: skulls }
|
52
|
-
```
|
53
|
-
|
54
|
-
##### #arena(options={})
|
55
|
-
> Not defined yet. No public endpoint.
|
56
|
-
> To be complete when there is one.
|
57
|
-
|
58
|
-
##### #xur
|
59
|
-
> Work in progress, will return items being sold as well as prices and location.
|
60
|
-
|
61
|
-
##### #place(place_hash)
|
62
|
-
> Returns a hash object
|
63
|
-
```
|
64
|
-
{ place_name: raw_data['placeName'],
|
65
|
-
place_desc: raw_data['placeDescription'] }
|
66
|
-
```
|
67
|
-
|
68
|
-
##### #destination(dest_hash)
|
69
|
-
> Returns a hash object
|
70
|
-
```
|
71
|
-
{ dest_name: raw_data['destinationName'],
|
72
|
-
dest_desc: raw_data['destinationDescription'] }
|
73
|
-
|
74
|
-
```
|
data/lib/lita-destiny.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require "lita"
|
2
|
+
require "destiny_rb"
|
2
3
|
|
3
4
|
# Bring in locales from '/locales/*.yml'
|
4
5
|
Lita.load_locales Dir[File.expand_path(
|
@@ -6,7 +7,6 @@ Lita.load_locales Dir[File.expand_path(
|
|
6
7
|
)]
|
7
8
|
|
8
9
|
# Require core files
|
9
|
-
require "destiny/base_api"
|
10
10
|
require "lita/handlers/destiny"
|
11
11
|
|
12
12
|
# Require response templates
|
data/lita-destiny.gemspec
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
Gem::Specification.new do |spec|
|
2
2
|
spec.name = "lita-destiny"
|
3
|
-
spec.version = "0.
|
3
|
+
spec.version = "0.2.0"
|
4
4
|
spec.authors = ["PDaily"]
|
5
5
|
spec.email = ["pat.irwin4@gmail.com"]
|
6
6
|
spec.description = "Small lita.io handler for interacting with the Destiny API"
|
@@ -15,7 +15,7 @@ Gem::Specification.new do |spec|
|
|
15
15
|
spec.require_paths = ["lib"]
|
16
16
|
|
17
17
|
spec.add_runtime_dependency "lita", "~> 4.3"
|
18
|
-
spec.add_runtime_dependency "
|
18
|
+
spec.add_runtime_dependency "destiny_rb", "~> 0.1"
|
19
19
|
|
20
20
|
spec.add_development_dependency "bundler", "~> 1.3"
|
21
21
|
spec.add_development_dependency "pry-byebug", "~> 3.1", ">= 3.1.0"
|
@@ -25,4 +25,4 @@ Gem::Specification.new do |spec|
|
|
25
25
|
spec.add_development_dependency "simplecov", "~> 0.10", ">= 0.10.0"
|
26
26
|
spec.add_development_dependency "coveralls", "~> 0.8", ">= 0.8.1"
|
27
27
|
spec.add_development_dependency "codeclimate-test-reporter"
|
28
|
-
end
|
28
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lita-destiny
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- PDaily
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-08-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: lita
|
@@ -25,25 +25,19 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '4.3'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: destiny_rb
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0.
|
34
|
-
- - ">="
|
35
|
-
- !ruby/object:Gem::Version
|
36
|
-
version: 0.13.5
|
33
|
+
version: '0.1'
|
37
34
|
type: :runtime
|
38
35
|
prerelease: false
|
39
36
|
version_requirements: !ruby/object:Gem::Requirement
|
40
37
|
requirements:
|
41
38
|
- - "~>"
|
42
39
|
- !ruby/object:Gem::Version
|
43
|
-
version: '0.
|
44
|
-
- - ">="
|
45
|
-
- !ruby/object:Gem::Version
|
46
|
-
version: 0.13.5
|
40
|
+
version: '0.1'
|
47
41
|
- !ruby/object:Gem::Dependency
|
48
42
|
name: bundler
|
49
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -205,7 +199,6 @@ files:
|
|
205
199
|
- LICENSE
|
206
200
|
- README.md
|
207
201
|
- Rakefile
|
208
|
-
- lib/destiny/base_api.rb
|
209
202
|
- lib/lita-destiny.rb
|
210
203
|
- lib/lita/handlers/destiny.rb
|
211
204
|
- lita-destiny.gemspec
|
@@ -234,7 +227,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
234
227
|
version: '0'
|
235
228
|
requirements: []
|
236
229
|
rubyforge_project:
|
237
|
-
rubygems_version: 2.
|
230
|
+
rubygems_version: 2.4.8
|
238
231
|
signing_key:
|
239
232
|
specification_version: 4
|
240
233
|
summary: Lightweight handler to help consume information related to Destiny the game
|
data/lib/destiny/base_api.rb
DELETED
@@ -1,169 +0,0 @@
|
|
1
|
-
require 'httparty'
|
2
|
-
require 'pp'
|
3
|
-
# DestinyAPI module wrapper
|
4
|
-
module DestinyAPI
|
5
|
-
# Base API Class
|
6
|
-
#
|
7
|
-
# Usage:
|
8
|
-
# destiny = DestinyAPI::Base.new(api_token)
|
9
|
-
#
|
10
|
-
class Base
|
11
|
-
# Include HTTParty Module
|
12
|
-
include HTTParty
|
13
|
-
# Auto-parse responses from Bungie as JSON
|
14
|
-
format :json
|
15
|
-
# Set base uri
|
16
|
-
base_uri 'www.bungie.net/Platform/Destiny/'
|
17
|
-
|
18
|
-
|
19
|
-
# Init the Destiny API with Bungie API stored in ENV variable
|
20
|
-
#
|
21
|
-
# Usage:
|
22
|
-
# destiny = DestinyAPI::Base.new('6971067dec36c6597cd57789a62f48f0')
|
23
|
-
#
|
24
|
-
# Arguments:
|
25
|
-
# api_token: (String)
|
26
|
-
#
|
27
|
-
def initialize(api_token)
|
28
|
-
@headers = { 'X-API-Key' => api_token, 'Content-Type' => 'application/json' }
|
29
|
-
end
|
30
|
-
|
31
|
-
# GET the days advisor report from http://www.bungie.net/platform/destiny/advisors/
|
32
|
-
#
|
33
|
-
# Usage:
|
34
|
-
# destiny.advisors
|
35
|
-
#
|
36
|
-
def advisors
|
37
|
-
raw_data = self.class.get('/Advisors', headers: @headers)
|
38
|
-
parsed = raw_data.parsed_response['Response']['data']
|
39
|
-
end
|
40
|
-
|
41
|
-
# GET the activity information from http://www.bungie.net/platform/destiny/manifest/activity/{activity_hash}/
|
42
|
-
#
|
43
|
-
# Raw argument will return an unmodified respons from Bungie.
|
44
|
-
#
|
45
|
-
# Usage:
|
46
|
-
# destiny.activity('3508129769', false)
|
47
|
-
#
|
48
|
-
# Arguments:
|
49
|
-
# activity_hash: (String)
|
50
|
-
# raw: (Boolean)
|
51
|
-
#
|
52
|
-
def activity(activity_hash, raw=false)
|
53
|
-
raw_data = self.class.get("/Manifest/Activity/#{activity_hash}").parsed_response['Response']['data']['activity']
|
54
|
-
skulls = []
|
55
|
-
raw_data['skulls'].each do |skull|
|
56
|
-
skulls << skull['displayName']
|
57
|
-
end
|
58
|
-
unless raw == true
|
59
|
-
parsed_data = { activityName: raw_data['activityName'], activityDescription: raw_data['activityDescription'], skulls: skulls }
|
60
|
-
else
|
61
|
-
raw_data
|
62
|
-
end
|
63
|
-
end
|
64
|
-
|
65
|
-
# GET the weekly nightfall info from http://www.bungie.net/platform/destiny/manifest/activity/#{activity_hash}
|
66
|
-
#
|
67
|
-
# Optional boolean argument.
|
68
|
-
#
|
69
|
-
# Usage:
|
70
|
-
# destiny.nightfall(true)
|
71
|
-
#
|
72
|
-
# Arguments:
|
73
|
-
# raw: (boolean)
|
74
|
-
#
|
75
|
-
def nightfall(raw=false)
|
76
|
-
nightfall_activity_hash = self.advisors['nightfallActivityHash']
|
77
|
-
activity(nightfall_activity_hash, raw)
|
78
|
-
end
|
79
|
-
|
80
|
-
# GET the weekly nightfall info from http://www.bungie.net/platform/destiny/manifest/activity/#{activity_hash}
|
81
|
-
# Returns an array of three items, only need one for the skulls and location.
|
82
|
-
#
|
83
|
-
# Optional boolean argument, defaults to false from activity method to return basic information for Lita bot.
|
84
|
-
#
|
85
|
-
# Usage:
|
86
|
-
# destiny.weekly_strike(false)
|
87
|
-
#
|
88
|
-
# Arguments:
|
89
|
-
# raw: (boolean)
|
90
|
-
#
|
91
|
-
def weekly_strike(raw=false)
|
92
|
-
heroic_strike_hashes = self.advisors['heroicStrikeHashes']
|
93
|
-
activity(heroic_strike_hashes[0], raw)
|
94
|
-
end
|
95
|
-
|
96
|
-
# GET the weekly nightfall info from http://www.bungie.net/platform/destiny/manifest/activity/#{activity_hash}
|
97
|
-
#
|
98
|
-
# No known endpoints.
|
99
|
-
def arena(options={})
|
100
|
-
end
|
101
|
-
|
102
|
-
def search_destiny_player(player_name, platform_type)
|
103
|
-
raw_data = self.class.get("/SearchDestinyPlayer/#{platform_type}/#{player_name}/").parsed_response['Response']['membershipId']
|
104
|
-
end
|
105
|
-
|
106
|
-
def get_destiny_account(player_name, platform_type)
|
107
|
-
member_id = self.search_destiny_player(player_name, platform_type)
|
108
|
-
raw_data = self.class.get("/#{platform_type}/Account/#{member_id}/").parsed_response['Response']['data']
|
109
|
-
end
|
110
|
-
|
111
|
-
def get_manifest_item(type_id, item_id)
|
112
|
-
raw_data = self.class.get("/Manifest/#{type_id}/#{item_id}").parsed_response['Response']['data']['inventoryItem']
|
113
|
-
end
|
114
|
-
|
115
|
-
# WIP: Pull xur inventory
|
116
|
-
# http://www.bungie.net/platform/destiny/advisors/xur/
|
117
|
-
def xur(raw=false)
|
118
|
-
raw_data = self.class.get('/Advisors/Xur/').parsed_response['Response']['data']
|
119
|
-
vendor_hash = raw_data['vendorHash']
|
120
|
-
sale_items = {}
|
121
|
-
|
122
|
-
# Hacky? Probs.
|
123
|
-
raw_data['saleItemCategories'].each do |category|
|
124
|
-
items = { category['categoryTitle'] => category['saleItems'].map!{|item| {:item_hash => item['item']['itemHash'], :item_cost => item['costs'][0]['value'], :item_cost_hash => item['costs'][0]['itemHash']} } }
|
125
|
-
sale_items.merge!(items)
|
126
|
-
end
|
127
|
-
|
128
|
-
if raw
|
129
|
-
raw_data
|
130
|
-
else
|
131
|
-
sale_items
|
132
|
-
end
|
133
|
-
end
|
134
|
-
|
135
|
-
def vendor(vendor_hash)
|
136
|
-
raw_data = self.class.get("/Manifest/Vendor/#{vendor_hash}").parsed_response['Response']['data']['vendor']['summary']
|
137
|
-
end
|
138
|
-
|
139
|
-
# Pull the days bounties
|
140
|
-
def bounties
|
141
|
-
end
|
142
|
-
|
143
|
-
# GET information about a place, specifically a planet.
|
144
|
-
#
|
145
|
-
# Usage:
|
146
|
-
# destiny.place('3747705955')
|
147
|
-
#
|
148
|
-
# Arguments:
|
149
|
-
# place_hash: (String)
|
150
|
-
#
|
151
|
-
def place(place_hash)
|
152
|
-
raw data = self.class.get('/Manifest/Place/#{place_hash}').parsed_response['Response']['data']['place']
|
153
|
-
response = { place_name: raw_data['placeName'], place_desc: raw_data['placeDescription'] }
|
154
|
-
end
|
155
|
-
|
156
|
-
# GET information about a destination, specifically a location on a planet.
|
157
|
-
#
|
158
|
-
# Usage:
|
159
|
-
# destiny.destination('518553403')
|
160
|
-
#
|
161
|
-
# Arguments:
|
162
|
-
# destination_hash: (String)
|
163
|
-
#
|
164
|
-
def destination(destination_hash)
|
165
|
-
raw_data = self.class.get('/Manifest/Destination/#{destination_hash}').parsed_response['Response']['data']
|
166
|
-
response = { dest_name: raw_data['destinationName'], dest_desc: raw_data['destinationDescription'] }
|
167
|
-
end
|
168
|
-
end
|
169
|
-
end
|