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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 405bd37d2e9d10d9c6dc5379d9c1b846c1a06a1037d06652ec769621048b6742
4
- data.tar.gz: 2aa2bfe77821734c7ca8780886c3a251d2c32851d371dfb21183cf7975aac49d
3
+ metadata.gz: 1ee640c0b1c065b981c1b6cb611a8c8fe799befc758765d2f913a7a538758ef3
4
+ data.tar.gz: fc46bed466daeef4d5b757de3ecaa25dfa95f7b54a110dc9d5178f2b542b0d14
5
5
  SHA512:
6
- metadata.gz: d587d8c72ec198272080cfa04f818e86829b3db7a5acf99e96d294c46e5bac465574491cb1a3da13a2441c8dc36f1505b9e2df347c2db347ee3d5847330c2a5c
7
- data.tar.gz: 9ed59ec813ed6d64291d25f3628ce2dd58afbad65af87672a97af7a7c0921bec87b97739420423072dea10276ca87dca8be5e5cfc3412059116d42f3d396f9d2
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.3.0 CFNetwork/974.2.1 Darwin/18.0.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
@@ -1,3 +1,3 @@
1
1
  module CompanionApi
2
- VERSION = '0.1.3'.freeze
2
+ VERSION = '0.1.5'.freeze
3
3
  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.3
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: 2018-11-27 00:00:00.000000000 Z
11
+ date: 2019-01-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler