tokyo_api 1.7.0 → 1.8.0
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 +4 -4
- data/.ruby-version +1 -1
- data/VERSION +1 -1
- data/lib/tokyo_api/client.rb +4 -0
- data/lib/tokyo_api/external_image.rb +13 -0
- data/lib/tokyo_api.rb +1 -0
- data/spec/external_image_spec.rb +37 -0
- data/tokyo_api.gemspec +6 -4
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: da756851722d19fe2817efef68b7800fc078f3a56e6494fbd83e1728576dcb92
|
4
|
+
data.tar.gz: ea742d2a8fb9a47eb773b60c0b7d364b9e4057d9679c4f4da9fc8a6cdf7097ca
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 918a3f26f02b51ba6893f218b3dab6f34e9089d163715b10947aabff02ba1f8bf0890cfd637070944865c8cf0f1da1f0045241f28aad4a2e60f1e62e055edbcd
|
7
|
+
data.tar.gz: 7633e4061040949bf31d27352f7e6a4e1119c96e8b6959588e1b350b1721bad1c05745a3da5d8daba63d527ae96be976454538f1335b61d58d59aaee14296820
|
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
3.
|
1
|
+
3.1.2
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.8.0
|
data/lib/tokyo_api/client.rb
CHANGED
@@ -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
@@ -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.
|
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.
|
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-
|
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.
|
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.
|
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-
|
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.
|
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
|