tokyo_api 1.7.0 → 1.8.0

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: 1632d0b0d73603bbf7eba85d8343f91cb8ee95926cf4b1e9e82dcd7e8e2674f7
4
- data.tar.gz: 96e8a638a06c798c45e54b40e2018a1a0c5652614363c9f094e95c08cbdddc18
3
+ metadata.gz: da756851722d19fe2817efef68b7800fc078f3a56e6494fbd83e1728576dcb92
4
+ data.tar.gz: ea742d2a8fb9a47eb773b60c0b7d364b9e4057d9679c4f4da9fc8a6cdf7097ca
5
5
  SHA512:
6
- metadata.gz: e161f064e5dc728c24bafd7e4062eaef534ce63f2b278ba3cde492e8e5688156d5667f24fe858ded83fff39f21487085bbd15acc2ae73c52831bcafa6cdd1c38
7
- data.tar.gz: 13c6dc24f97b53163e12e8f8e134a7e7c1e709d3847a6edfec9df131cbbd35e6053784482d1e5757b88bf5fdd98cc29f4ce1177e4f3c001dc097b3573fee113e
6
+ metadata.gz: 918a3f26f02b51ba6893f218b3dab6f34e9089d163715b10947aabff02ba1f8bf0890cfd637070944865c8cf0f1da1f0045241f28aad4a2e60f1e62e055edbcd
7
+ data.tar.gz: 7633e4061040949bf31d27352f7e6a4e1119c96e8b6959588e1b350b1721bad1c05745a3da5d8daba63d527ae96be976454538f1335b61d58d59aaee14296820
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 3.0.3
1
+ 3.1.2
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.7.0
1
+ 1.8.0
@@ -16,6 +16,10 @@ module TokyoApi
16
16
  @identity ||= TokyoApi::Identity.new(client: self)
17
17
  end
18
18
 
19
+ def external_image
20
+ @external_image ||= TokyoApi::ExternalImage.new(client: self)
21
+ end
22
+
19
23
  def expire
20
24
  @expire ||= TokyoApi::Expire.new(client: self)
21
25
  end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module TokyoApi
4
+ class ExternalImage < Base
5
+ def base_path
6
+ 'external_image'
7
+ end
8
+
9
+ def track_download(photo_id)
10
+ client.post_request("#{normalized_base_path}#{url_escape(photo_id)}/download").status == 204
11
+ end
12
+ end
13
+ end
data/lib/tokyo_api.rb CHANGED
@@ -5,6 +5,7 @@ require 'tokyo_api/base'
5
5
  require 'tokyo_api/actionkit'
6
6
  require 'tokyo_api/campact'
7
7
  require 'tokyo_api/client'
8
+ require 'tokyo_api/external_image'
8
9
  require 'tokyo_api/expire'
9
10
  require 'tokyo_api/identity'
10
11
 
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ require File.expand_path("#{File.dirname(__FILE__)}/spec_helper")
4
+
5
+ describe TokyoApi::ExternalImage do
6
+ subject { TokyoApi.new(host: 'test.com') }
7
+
8
+ describe '#track_download' do
9
+ let(:photo_id) { 'abcde-123456' }
10
+ let(:request_path) { "/external_image/#{photo_id}/download" }
11
+
12
+ before(:each) do
13
+ stub_post(request_path).to_return(body: body, status: status,
14
+ headers: { content_type: 'application/json; charset=utf-8' })
15
+ end
16
+
17
+ context 'error on tokyo' do
18
+ let(:status) { 500 }
19
+ let(:body) { {status: :error}.to_json }
20
+
21
+ it 'should raise error' do
22
+ expect { subject.external_image.track_download(photo_id) }.to raise_error(Vertebrae::ResponseError)
23
+ end
24
+ end
25
+
26
+ context 'successful call to tokyo' do
27
+ let(:status) { 204 }
28
+ let(:body) { nil }
29
+
30
+ it 'should return true' do
31
+ result = subject.external_image.track_download(photo_id)
32
+
33
+ expect(result).to be_truthy
34
+ end
35
+ end
36
+ end
37
+ end
data/tokyo_api.gemspec CHANGED
@@ -2,16 +2,16 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Juwelier::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: tokyo_api 1.7.0 ruby lib
5
+ # stub: tokyo_api 1.8.0 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "tokyo_api".freeze
9
- s.version = "1.7.0"
9
+ s.version = "1.8.0"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib".freeze]
13
13
  s.authors = ["Nathan Woodhull".freeze]
14
- s.date = "2022-02-22"
14
+ s.date = "2022-11-25"
15
15
  s.description = "Tokyo is a CRM middleware, this gem helps apps talk to it.".freeze
16
16
  s.email = "nathan@controlshiftlabs.com".freeze
17
17
  s.extra_rdoc_files = [
@@ -36,11 +36,13 @@ Gem::Specification.new do |s|
36
36
  "lib/tokyo_api/campact.rb",
37
37
  "lib/tokyo_api/client.rb",
38
38
  "lib/tokyo_api/expire.rb",
39
+ "lib/tokyo_api/external_image.rb",
39
40
  "lib/tokyo_api/identity.rb",
40
41
  "spec/actionkit_spec.rb",
41
42
  "spec/campact_spec.rb",
42
43
  "spec/client_spec.rb",
43
44
  "spec/expire_spec.rb",
45
+ "spec/external_image_spec.rb",
44
46
  "spec/fixtures/expire/success",
45
47
  "spec/fixtures/responses/actionkit/full_user_success",
46
48
  "spec/fixtures/responses/campact/full_user_success",
@@ -55,7 +57,7 @@ Gem::Specification.new do |s|
55
57
  ]
56
58
  s.homepage = "http://github.com/controlshift/tokyo_api".freeze
57
59
  s.licenses = ["MIT".freeze]
58
- s.rubygems_version = "3.2.32".freeze
60
+ s.rubygems_version = "3.3.19".freeze
59
61
  s.summary = "Ruby API Wrapper for Tokyo CRM service".freeze
60
62
 
61
63
  if s.respond_to? :specification_version then
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tokyo_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.0
4
+ version: 1.8.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nathan Woodhull
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2022-02-22 00:00:00.000000000 Z
11
+ date: 2022-11-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: vertebrae
@@ -133,11 +133,13 @@ files:
133
133
  - lib/tokyo_api/campact.rb
134
134
  - lib/tokyo_api/client.rb
135
135
  - lib/tokyo_api/expire.rb
136
+ - lib/tokyo_api/external_image.rb
136
137
  - lib/tokyo_api/identity.rb
137
138
  - spec/actionkit_spec.rb
138
139
  - spec/campact_spec.rb
139
140
  - spec/client_spec.rb
140
141
  - spec/expire_spec.rb
142
+ - spec/external_image_spec.rb
141
143
  - spec/fixtures/expire/success
142
144
  - spec/fixtures/responses/actionkit/full_user_success
143
145
  - spec/fixtures/responses/campact/full_user_success
@@ -168,7 +170,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
168
170
  - !ruby/object:Gem::Version
169
171
  version: '0'
170
172
  requirements: []
171
- rubygems_version: 3.2.32
173
+ rubygems_version: 3.3.19
172
174
  signing_key:
173
175
  specification_version: 4
174
176
  summary: Ruby API Wrapper for Tokyo CRM service