richard-cli 1.2.0 → 1.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,7 @@
1
1
  ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- NWM3ZDA1MGU0YWQzMjQyMGU4NzU0NmFlNGI0ZGVmMTM2NzZiYWMyZA==
5
- data.tar.gz: !binary |-
6
- MjdhNTkxOTE3MDVjODFjYjg4MGJiNWVmNzc1MDVmZTczOWQwMDViMw==
2
+ SHA1:
3
+ metadata.gz: f38710471d887fdeab9eae15d46ca3bd97651e5b
4
+ data.tar.gz: 7670d78b67b08fe2a7630488a1c1ae4ee9527399
7
5
  SHA512:
8
- metadata.gz: !binary |-
9
- ZjI2Zjg5MDJjNTQ1OThiYjMxMjBhM2Q0ZmVkNTk5NGQ5Y2JkZjllYmJjZDQw
10
- NGI0OTBiNDA5MGViOTMzZmZiZDE5YTY4YmVmOGYxODU0MDFmNzgwNmI2OGVk
11
- MTIxMzNmN2RlNThkYjI3MTY4NmNkMzAyNTNhNjNjNzBlYzZiNGI=
12
- data.tar.gz: !binary |-
13
- MWM0NjA1OWE3NjdiZjIwMWM4OTYwNzYwMmYzMDA0NTI2OTE2ZGFjYjQ4Yzc2
14
- OTM5YTlkOTRmZTA5Y2VmYmYxMjhkOWZkNjdhNGUzMDg4MGQwYTY0YzQ0YTA4
15
- OGNjMDk4MmJhZWRhMDZlYTZjZDQyMzQ5MTc4NmMxZDBmOTc1M2E=
6
+ metadata.gz: 36052f1f4fd9d79eb70d0d291f94a52a1ffeb598b8e400aba09449d2aec2bbe9af462ebd5001095fe0b995009ca4bfae4557a5f4aac499263602a5749540cb4a
7
+ data.tar.gz: db9380d8439c764dcd2bfed63c9a1b58f44e7a4bd5240d49cc03e0ef3242832727d53338771d56fe26e78eeb62331f8b9bbc05569f96b9590f03aea36a3a555e
data/README.md CHANGED
@@ -18,6 +18,7 @@ Install it yourself as:
18
18
  grab - Add yourself to the queue
19
19
  release - Removes you from the queue
20
20
  force_release - Force releases another user. The user_id must be provided.
21
+ is_it_my_turn - Returns 'Yes' or 'No'. It also returns status code 0 for 'Yes' and -1 for 'No'
21
22
 
22
23
  ## Contributing
23
24
 
@@ -1,3 +1,3 @@
1
1
  module Richard
2
- VERSION = "1.2.0"
2
+ VERSION = "1.2.1"
3
3
  end
data/lib/richard.rb CHANGED
@@ -35,7 +35,7 @@ module Richard
35
35
  def is_it_my_turn
36
36
  response = JSON.parse(RestClient.get(@base_url + "/queue/status?format=json&api_key=#{@api_key}"))
37
37
 
38
- if response['content']['queue_transaction']['status'] == 'running'
38
+ if is_my_turn?(response)
39
39
  puts 'yes'
40
40
  exit 0
41
41
  else
@@ -46,6 +46,11 @@ module Richard
46
46
 
47
47
  private
48
48
 
49
+ def is_my_turn?(response)
50
+ queue_data = response['content'].fetch('queue_transaction') { {} }
51
+ queue_data['status'] == 'running'
52
+ end
53
+
49
54
  def send_command(url)
50
55
  RestClient.post(@base_url + url, api_key: @api_key)
51
56
  rescue RestClient::UnprocessableEntity => e
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: richard-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adam Kerr
@@ -14,84 +14,84 @@ dependencies:
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.6'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.6'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: rake
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
33
  version: '10.0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
40
  version: '10.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: json
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ! '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: '0'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ! '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: '0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rest-client
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ! '>='
59
+ - - ">="
60
60
  - !ruby/object:Gem::Version
61
61
  version: '0'
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ! '>='
66
+ - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: highline
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ! '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ! '>='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: terminal-table
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ! '>='
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ! '>='
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  description: ''
@@ -102,7 +102,7 @@ executables:
102
102
  extensions: []
103
103
  extra_rdoc_files: []
104
104
  files:
105
- - .gitignore
105
+ - ".gitignore"
106
106
  - Gemfile
107
107
  - LICENSE.txt
108
108
  - README.md
@@ -125,17 +125,17 @@ require_paths:
125
125
  - lib
126
126
  required_ruby_version: !ruby/object:Gem::Requirement
127
127
  requirements:
128
- - - ! '>='
128
+ - - ">="
129
129
  - !ruby/object:Gem::Version
130
130
  version: '0'
131
131
  required_rubygems_version: !ruby/object:Gem::Requirement
132
132
  requirements:
133
- - - ! '>='
133
+ - - ">="
134
134
  - !ruby/object:Gem::Version
135
135
  version: '0'
136
136
  requirements: []
137
137
  rubyforge_project:
138
- rubygems_version: 2.4.3
138
+ rubygems_version: 2.4.6
139
139
  signing_key:
140
140
  specification_version: 4
141
141
  summary: A command line interface for richard