timely-app 1.0.3 → 1.0.5

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: cb007aeefb95161536612d0873a2af916979e63090722db4058ef085ea61b9d7
4
- data.tar.gz: f635b0b3c8824b054230cc30e05511b6a52d79b1eaeb8d85312d7467717309e5
3
+ metadata.gz: 4ec56417b676069c4da9087632caff37bef3e07dcf32c070e0d82bf46b4ee041
4
+ data.tar.gz: 40f7413ba2534eb51232990498e15a3919e69c90adb4c9e2aeeea3a3733cf2c7
5
5
  SHA512:
6
- metadata.gz: 21e914d28e5f658f279191910064353341efe89c461a74ab9d3243db7569dde398f085fed5497639164ac956c4bbabd2a6bcaabe5ae2e5997fe9c9b891216f3f
7
- data.tar.gz: 2ebf7294e89b0dfde01076bd02c5dec9eee2272f1ae1b83c617f50f13a119b8e2a45704f3e7ff7735769cd05a6b1d905310c578bb12c4a6b16bd14566a5b3cfe
6
+ metadata.gz: 399c5951f95667b2a774d834b98f14a50e459563ddc660dd5eef74955dea5dad7b33d3b43c689bfc759103c47c68bdb56616908b9d3e7bd3089beb4caea695b8
7
+ data.tar.gz: 1bc73a047fa303766e38381505d9498a7a01fc531178b679dd0c358976df70303dd136cd4057d8c49fd13cef82dbaf623821860aa2d008e0a4895b1cdffac38e
data/CHANGELOG.md CHANGED
@@ -1,3 +1,11 @@
1
+ # 1.0.5
2
+
3
+ * Fix verbose mode check
4
+
5
+ # 1.0.4
6
+
7
+ * Update CLI to check input properly and handle command arguments
8
+
1
9
  # 1.0.3
2
10
 
3
11
  * Fix gemspec
data/README.md CHANGED
@@ -22,10 +22,12 @@ gem install timely-app
22
22
 
23
23
  Register your local service at https://app.timelyapp.com/{account_id}/oauth_applications
24
24
 
25
- Run auth script:
25
+ Install `timely-app` gem as dependency or globally.
26
+
27
+ Run auth:
26
28
 
27
29
  ```sh
28
- TIMELY_CLIENT_ID=<CLIENT_ID> TIMELY_CLIENT_SECRET=<CLIENT_SECRET> ./examples/auth_cli.rb
30
+ TIMELY_CLIENT_ID=<client_id> TIMELY_CLIENT_SECRET=<client_secret> bundle exec timely-app auth -s
29
31
  ```
30
32
 
31
33
  ## Usage for web service
@@ -89,6 +91,14 @@ There are large list of available tools for tunneling: [awesome-tunneling](https
89
91
 
90
92
  Bug reports and pull requests are welcome on GitHub at https://github.com/amkisko/timely-app
91
93
 
94
+ ## Publishing
95
+
96
+ ```sh
97
+ rm timely-app-*.gem
98
+ gem build timely-app.gemspec
99
+ gem push timely-app-*.gem
100
+ ```
101
+
92
102
  ## License
93
103
 
94
104
  The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
data/bin/timely-app CHANGED
@@ -26,6 +26,8 @@ module TimelyApp
26
26
  end
27
27
 
28
28
  def command_exists?(cmd)
29
+ return false if cmd.nil? || cmd.empty?
30
+
29
31
  client.respond_to?(cmd)
30
32
  end
31
33
 
@@ -139,10 +141,11 @@ cli = TimelyApp::CLI.new(options)
139
141
  cmd = ARGV.shift
140
142
  case cmd
141
143
  when "auth"
142
- if ARGV.length == 0
143
- cli.auth(ENV.fetch('TIMELY_CLIENT_ID'), ENV.fetch('TIMELY_CLIENT_SECRET'))
144
- elsif ARGV.length == 2
145
- cli.auth(ARGV.shift, ARGV.shift)
144
+ client_id = ARGV.shift || ENV.fetch('TIMELY_CLIENT_ID')
145
+ client_secret = ARGV.shift || ENV.fetch('TIMELY_CLIENT_SECRET')
146
+ ARGV.clear
147
+ if client_id && client_secret
148
+ cli.auth(client_id, client_secret)
146
149
  else
147
150
  puts "Usage: timely-app auth CLIENT_ID CLIENT_SECRET"
148
151
  exit 1
@@ -158,8 +161,9 @@ when "config"
158
161
  end
159
162
  else
160
163
  if cli.command_exists?(cmd)
161
- response = cli.call(cmd, *ARGV)
164
+ args = ARGV.reduce({}){ |h, arg| k, v = arg.split("="); h[k] = v; h }
162
165
  ARGV.clear
166
+ response = cli.call(cmd, *args)
163
167
  case response
164
168
  when Array
165
169
  response.each do |r|
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'timely-app/version'
3
4
  require 'timely-app/errors'
4
5
  require 'timely-app/link_header'
@@ -13,7 +14,8 @@ module TimelyApp
13
14
  attr_accessor :account_id
14
15
 
15
16
  def initialize(options = {})
16
- @auth_header, @auth_value = 'Authorization', "Bearer #{options[:access_token]}"
17
+ @auth_header = 'Authorization'
18
+ @auth_value = "Bearer #{options[:access_token]}"
17
19
  @user_agent = options.fetch(:user_agent) { "timely-app/#{VERSION} ruby/#{RUBY_VERSION}" }
18
20
 
19
21
  @host = 'api.timelyapp.com'
@@ -22,7 +24,7 @@ module TimelyApp
22
24
  @http.use_ssl = true
23
25
 
24
26
  @account_id = options[:account_id]
25
- @verbose = options[:verbose] || ENV['VERBOSE'] || false
27
+ @verbose = options[:verbose] || !ENV['VERBOSE'].nil? || false
26
28
  end
27
29
 
28
30
  def get(path, params = nil)
@@ -32,7 +34,7 @@ module TimelyApp
32
34
  private
33
35
 
34
36
  def verbose?
35
- !@verbose.nil?
37
+ @verbose == true
36
38
  end
37
39
 
38
40
  def host_uri_join(path, params)
@@ -67,11 +69,9 @@ module TimelyApp
67
69
  puts "<< response: #{http_request.method} #{http_request.path} #{response.code} #{response.body}"
68
70
  end
69
71
 
70
- if response.is_a?(Net::HTTPSuccess)
71
- Response.parse(response)
72
- else
73
- raise Response.error(response)
74
- end
72
+ raise Response.error(response) unless response.is_a?(Net::HTTPSuccess)
73
+
74
+ Response.parse(response)
75
75
  end
76
76
  end
77
77
  end
@@ -1,3 +1,3 @@
1
1
  module TimelyApp
2
- VERSION = '1.0.3'
2
+ VERSION = '1.0.5'
3
3
  end
data/timely-app.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = "timely-app"
3
- s.version = "1.0.3"
3
+ s.version = "1.0.5"
4
4
 
5
5
  s.license = "MIT"
6
6
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: timely-app
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.3
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrei Makarov
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-02-14 00:00:00.000000000 Z
11
+ date: 2023-03-02 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Ruby client for the Timely API
14
14
  email: