companion_api 0.1.3 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +7 -1
- data/lib/companion_api/request.rb +1 -1
- data/lib/companion_api/resources/login.rb +13 -0
- data/lib/companion_api/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1ee640c0b1c065b981c1b6cb611a8c8fe799befc758765d2f913a7a538758ef3
|
4
|
+
data.tar.gz: fc46bed466daeef4d5b757de3ecaa25dfa95f7b54a110dc9d5178f2b542b0d14
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: acf2da12541aba85763c8c881cb48a45cb2babed122c3a3fbf56a4056cfec251f4595a9d2e35319ee5ceafd4cf485122dba5b64fb57afade55a270b0c1956851
|
7
|
+
data.tar.gz: aad40ce45af6e7065125dd6e7ffda619d5127bf79cbd0d280f3e25fba8dd8da784254dc92c5868d8baf5189cefd00f247d004bcfd18064968d28a13f54211703
|
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# CompanionApi
|
2
2
|
|
3
|
+
[![Gem Version](https://badge.fury.io/rb/companion_api.svg)](https://badge.fury.io/rb/companion_api)
|
4
|
+
|
3
5
|
This gem provides a wrapper to the SE Companion App Api, right now it only supports the marketplace, you are free to add the other endpoints.
|
4
6
|
|
5
7
|
This gem is basically a rewrite of the php Version from Vekien (https://github.com/xivapi/companion-php)
|
@@ -56,7 +58,7 @@ characters = api.login.characters
|
|
56
58
|
api.login.select_character(characters.first['cid'])
|
57
59
|
```
|
58
60
|
|
59
|
-
you can check if you are logged in to a character by using ```api.loggedin?```
|
61
|
+
you can check if you are logged in to a character by using ```api.loggedin?``` in some situations the token is marked as valid but a ```CompanionApi::TokenExpiredError``` error is raised.
|
60
62
|
|
61
63
|
### Marketplace
|
62
64
|
|
@@ -76,6 +78,10 @@ result = api.market.transaction_history(5)
|
|
76
78
|
>> result["history"]
|
77
79
|
```
|
78
80
|
|
81
|
+
## Known Problems
|
82
|
+
|
83
|
+
If you login in one thread and request data in another the request will fail and in some situations the token will get invalid. If you encounter such problems, make sure the login process is completed before.
|
84
|
+
|
79
85
|
## Development
|
80
86
|
|
81
87
|
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.
|
@@ -34,7 +34,7 @@ module CompanionApi
|
|
34
34
|
'Accept' => '*/*',
|
35
35
|
'Accept-Language' => 'en-gb',
|
36
36
|
'Accept-Encoding' => 'br, gzip, deflate',
|
37
|
-
'User-Agent' => 'ffxivcomapp-e/1.0.
|
37
|
+
'User-Agent' => 'ffxivcomapp-e/1.0.5.0 CFNetwork/976 Darwin/18.2.0',
|
38
38
|
'request-id' => @args[:requestId] || CompanionApi.generate_uuid,
|
39
39
|
'token' => @args[:token],
|
40
40
|
}
|
@@ -83,6 +83,19 @@ module CompanionApi
|
|
83
83
|
json = JSON.parse(res.body)
|
84
84
|
|
85
85
|
@character = json
|
86
|
+
|
87
|
+
character_status
|
88
|
+
end
|
89
|
+
|
90
|
+
def character_status
|
91
|
+
req = CompanionApi::Request.new(
|
92
|
+
uri: @profile.get('region'),
|
93
|
+
endpoint: '/character/login-status',
|
94
|
+
token: @profile.get("token"),
|
95
|
+
)
|
96
|
+
|
97
|
+
res = req.get!
|
98
|
+
JSON.parse(res.body)
|
86
99
|
end
|
87
100
|
end
|
88
101
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: companion_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nils Berenbold
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-01-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|