getauthtoken 0.4.0 → 0.4.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 68681b938373b176e145a551cb269a38a25d6730685b0fc9a42ce2613a06151a
4
- data.tar.gz: 10e76d40cf115b6a99b823a1238c769d3ff2ad54b2cfd660b5d14a1fb4d6ecd2
3
+ metadata.gz: 36470fd7a5da225e693d83ccd434a83fe5a8a0331633fb7f070b8129bbd95a55
4
+ data.tar.gz: 88a34fe8d9e19ff26cac441a5055c3996228bc1d2e5cdfef91634eed37b6e12f
5
5
  SHA512:
6
- metadata.gz: b4159644067d1c8e793ef0dd778681854db8867b687f970903c082d0222b4588e60a36347569dc8fc97ef7d108d783998f2509767ac909473da1958d582055ab
7
- data.tar.gz: a7081d399e1b1f6393d82647b1f53e1f65fe8b6d0e368ea06783930ea5c0a429f0d3c117e82e1418f3ed612de6848582c97365cfb12462c4fbf15447a12e66ba
6
+ metadata.gz: 776884e842291b27555eef4268a7f15f6a55a29836f10cca04238937c168d56249d83f496ac0931d70bfbee1c2ce6048e3be39b72f10066fd045733c2181f5aa
7
+ data.tar.gz: 3c36a887c504cecd9d7085bcde5f6afff0712f5025427352275997222d006b06b14915365aa98df08570be139ee997ada4aea4dded2dee2396715735ff103488
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- getauthtoken (0.3.0)
4
+ getauthtoken (0.4.0)
5
5
  http (~> 4.2.0)
6
6
 
7
7
  GEM
data/README.md CHANGED
@@ -1,25 +1,25 @@
1
- # Getauthtoken
1
+ # getauthtoken
2
2
 
3
- `getauthtoken` is a small command line utility to acquire an authorization token from [Xaptum](https://dev.xaptum.io). It's intended to speed up the process of testing API's, since an authorization token is required as a header in every request and new tokens are generated every four hours.
3
+ `getauthtoken` is a small command line utility to acquire an authorization token from [Xaptum](https://dev.xaptum.io). It's intended to speed up the process of testing API's, since an authorization token is required as a header in every request and new tokens are generated every four hours.
4
4
 
5
5
  Running `getauthtoken` from your command line after installation (see below) will always give the current token.
6
6
 
7
7
  ## Installation
8
8
 
9
- First, clone the repository and install the gem locally. You may need to `sudo gem install` here.
9
+ First, install the gem from [Ruby Gems](https://rubygems.org). You may need to `sudo gem install` here.
10
10
 
11
11
  ```shell
12
- $ git clone https://github.com/dylanirlbeck/getauthtoken.git
13
- $ cd getauthtoken
14
- $ gem install getauthtoken-0.3.0.gem
12
+ $ gem install getauthtoken
15
13
  ```
16
14
 
17
- Second, we'll need to create JSON file that stores your Xaptum credentials. `getauthtoken` will always use the credentials in this file to acquire your auth token. In your `$HOME` directory, create the file `.xaptum_credentials.json` with the following structure:
15
+ Second, we'll need to create a JSON file `.xaptum_credentials.json` that stores your Xaptum credentials. `getauthtoken` will always use the credentials in this file to acquire your auth token.
16
+
17
+ In your `$HOME` directory, create the file `.xaptum_credentials.json` with the following structure:
18
18
 
19
19
  ```json
20
20
  {
21
- "username": "<YOUR_USERNAME>",
22
- "password": "<YOUR_PASSWORD>"
21
+ "username": "<YOUR_USERNAME>",
22
+ "password": "<YOUR_PASSWORD>"
23
23
  }
24
24
  ```
25
25
 
@@ -27,8 +27,6 @@ Second, we'll need to create JSON file that stores your Xaptum credentials. `get
27
27
 
28
28
  Simply run `getauthtoken` from the command line. The token should then appear and get copied to your clipboard.
29
29
 
30
- Note that you do **not** have to be in the `getauthtoken` project directory (that you cloned earlier) to use this utility.
31
-
32
30
  ```shell
33
31
  $ getauthtoken
34
32
  Authenticating with Xaptum...
@@ -37,12 +35,25 @@ Your token is <TOKEN>. It has been copied to the clipboard.
37
35
 
38
36
  ## Development
39
37
 
38
+ You can clone the repository and install the dependencies with [Bundler](https://bundler.io).
39
+
40
+ ```shell
41
+ $ git clone https://github.com/dylanirlbeck/getauthtoken.git
42
+ $ cd getauthtoken
43
+ $ bundle install
44
+ ```
45
+
40
46
  Write tests, pass tests, bump version, pull request.
41
47
 
42
- Running the tests
48
+ - **Write tests:** Write all tests in `test/getauthtoken_test.rb`.
49
+ - **Pass tests:** Write code in `lib/getauthtoken.rb` to pass the tests. You can run tests with `$ rake test`.
50
+ - **Bump version:** The current version of the gem is in `lib/getauthtoken/version.rb`. After you've made your changes, update this version by following the format `MAJOR.MINOR.PATCH`.
51
+ - **Pull request:** Open a PR! One of the maintainers will review your changes and work with you to get them merged.
52
+
53
+ For maintainers: building new gem version and pushing to Github and Ruby Gems
43
54
 
44
55
  ```shell
45
- $ rake test
56
+ $ bundle exec rake release
46
57
  ```
47
58
 
48
59
  ## Contributing
data/lib/getauthtoken.rb CHANGED
@@ -7,14 +7,14 @@ module Getauthtoken
7
7
 
8
8
  def self.authenticate()
9
9
  credentials = get_credentials()
10
- return post_credentials(credentials)
10
+ post_credentials(credentials)
11
11
  end
12
12
 
13
13
  def self.get_credentials()
14
14
  file = File.open(File.expand_path("~/.xaptum_credentials.json"))
15
15
  data = JSON.load file
16
16
  file.close
17
- return data
17
+ data
18
18
  end
19
19
 
20
20
  def self.post_credentials(credentials)
@@ -23,12 +23,11 @@ module Getauthtoken
23
23
  response = HTTP.headers("Content-Type": "application/json", "Accept": "application/json")
24
24
  .post(BASE_URL, body: json)
25
25
 
26
- return response.code == 200 ? JSON.parse(response)["data"][0]["token"] : nil
26
+ response.code == 200 ? JSON.parse(response)["data"][0]["token"] : nil
27
27
  end
28
28
 
29
29
  def self.pbcopy(token)
30
30
  IO.popen('pbcopy', 'w') { |f| f << token }
31
- token
32
31
  end
33
32
 
34
33
  end
@@ -1,3 +1,3 @@
1
1
  module Getauthtoken
2
- VERSION = "0.4.0"
2
+ VERSION = "0.4.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: getauthtoken
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dylan Irlbeck