portatext 1.5.2 → 1.5.3

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
  SHA1:
3
- metadata.gz: be8502396bcd95cacd2471fd23ba985456e4161a
4
- data.tar.gz: 1e346973a20ef25d50b8aedce0762f0487572fb4
3
+ metadata.gz: 0ea1a8905e2c094b9a61e6bbee55bd6535efcfa1
4
+ data.tar.gz: d312b954fd5f59223e4717cd97db2a6743f2508a
5
5
  SHA512:
6
- metadata.gz: 4b44f81fe8a886d9ac11898f3d523da493ac0ee72445b169cfcdcf1088e848d0bb25cfecaf49db5310c4e5e06c8502c1bc44f59e6c1c2401b5b742417d8bfbb9
7
- data.tar.gz: d6dd689faa392d63ca40c2a2f066b860610e6045f5ed2e68e4c0f8a39fbf9fc6fa0b7f5e14989f873224c7597b27a8b073445a5b0fa709055affe390cd6637c5
6
+ metadata.gz: a1bd0679d2a85b5849978dfb02ac3c1ccd7a126ceb34bfc6848ae8ebd83a42f20a0b7b606cd9d54c5e995b8d1bfc40febe9b4b7a447ef5f403894a669f7bf176
7
+ data.tar.gz: ef53c875e5ddc7ce7c300205dc51163e869154fbc9981beaf8803aa4079b79ea53614dc8c4e999e876c52ffe784b25608746bb6fcadb3eb84fc5b6d069055bc5
@@ -0,0 +1,28 @@
1
+ module PortaText
2
+ module Command
3
+ module Api
4
+ # The inspect endpoint.
5
+ # https://github.com/PortaText/docs/wiki/REST-API#api_inspect
6
+ #
7
+ # Author:: Marcelo Gornstein (mailto:marcelog@portatext.com)
8
+ # Copyright:: Copyright (c) 2015 PortaText
9
+ # License:: Apache-2.0
10
+ class NumberInspect < Base
11
+ def number(number)
12
+ set :number, number
13
+ end
14
+
15
+ def csv(file)
16
+ set :file, file
17
+ end
18
+
19
+ def endpoint(_method)
20
+ number = @args[:number]
21
+ @args.delete :number
22
+ return "inspect/#{number}" unless number.nil?
23
+ 'inspect'
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -16,6 +16,10 @@ module PortaText
16
16
  set :page, page
17
17
  end
18
18
 
19
+ def save_to(file)
20
+ set :accept_any_file, file
21
+ end
22
+
19
23
  def endpoint(_method)
20
24
  page = @args[:page]
21
25
  @args.delete :page
@@ -24,6 +28,7 @@ module PortaText
24
28
  return endpoint if @args[:id].nil?
25
29
  id = @args[:id]
26
30
  @args.delete :id
31
+ return "jobs/#{id}/result" unless @args[:accept_any_file].nil?
27
32
  "jobs/#{id}"
28
33
  end
29
34
  end
@@ -41,6 +41,7 @@ module PortaText
41
41
  end
42
42
 
43
43
  def accept_content_type(_method)
44
+ return '*/*' unless @args[:accept_any_file].nil?
44
45
  return 'text/csv' unless @args[:accept_file].nil?
45
46
  'application/json'
46
47
  end
@@ -61,7 +62,9 @@ module PortaText
61
62
  a_type = accept_content_type method
62
63
  command_endpoint = endpoint(method)
63
64
  file = @args[:accept_file]
65
+ file ||= @args[:accept_any_file]
64
66
  @args.delete :accept_file
67
+ @args.delete :accept_any_file
65
68
  @client.run(
66
69
  command_endpoint, method, content_type(method),
67
70
  a_type, body(method), file
data/lib/portatext.rb CHANGED
@@ -39,6 +39,7 @@ require_relative 'portatext/command/api/number_verify'
39
39
  require_relative 'portatext/command/api/services'
40
40
  require_relative 'portatext/command/api/trunks'
41
41
  require_relative 'portatext/command/api/version'
42
+ require_relative 'portatext/command/api/inspect'
42
43
 
43
44
  # The PortaText namespace.
44
45
  #
data/portatext.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'portatext'
3
- s.version = '1.5.2'
3
+ s.version = '1.5.3'
4
4
  s.summary = 'Official PortaText API ruby client'
5
5
  s.description = 'This is the official PortaText API ruby client'
6
6
  s.authors = ['PortaText']
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: portatext
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.5.2
4
+ version: 1.5.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - PortaText
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-26 00:00:00.000000000 Z
11
+ date: 2016-06-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: simplecov
@@ -150,6 +150,7 @@ files:
150
150
  - lib/portatext/command/api/did_search.rb
151
151
  - lib/portatext/command/api/did_settings.rb
152
152
  - lib/portatext/command/api/email_verify.rb
153
+ - lib/portatext/command/api/inspect.rb
153
154
  - lib/portatext/command/api/jobs.rb
154
155
  - lib/portatext/command/api/me.rb
155
156
  - lib/portatext/command/api/my_password.rb