trailer_vote-api 2.0.0 → 2.1.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/Gemfile.lock +11 -13
- data/lib/trailer_vote/api/autoload.rb +2 -0
- data/lib/trailer_vote/api/push_recipe_android.rb +39 -0
- data/lib/trailer_vote/api/push_recipe_ios.rb +39 -0
- data/lib/trailer_vote/api/version.rb +1 -1
- data/lib/trailer_vote/api.rb +6 -3
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b9ceec23ca6fee63d3e70a64844dcc68123a4ae9fd9cba82cb445be4fe9ead42
|
4
|
+
data.tar.gz: e86c319adbdd7893f6e96d98e95e771c1074acaa2c6a691fbf92423fdbc6760b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6034499012794304f01f4ad6865a820e44aa251471d29ec2cc3bb6d7548eb7274ab6502f0ddf4598c4f870086f7e6d43074b8796d039737dc8564faa198b4a3b
|
7
|
+
data.tar.gz: 04435e14b64fc7a1b11d2060896ef0ec25d792beead68f01230a3bf3a442cc2d82fd7bba728ecdc0c53c7ae0bc38160fa81050f8fb9748f1cef58050bc87833f
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
trailer_vote-api (2.
|
4
|
+
trailer_vote-api (2.1.0)
|
5
5
|
http (>= 3.3.0, <= 4.1.1)
|
6
6
|
oj (>= 3.6, < 4.x)
|
7
7
|
trailer_vote-media_types (~> 2.0)
|
@@ -13,7 +13,7 @@ GEM
|
|
13
13
|
public_suffix (>= 2.0.2, < 5.0)
|
14
14
|
ansi (1.5.0)
|
15
15
|
awesome_print (1.8.0)
|
16
|
-
builder (3.2.
|
16
|
+
builder (3.2.4)
|
17
17
|
crack (0.4.3)
|
18
18
|
safe_yaml (~> 1.0.0)
|
19
19
|
docile (1.3.2)
|
@@ -27,11 +27,10 @@ GEM
|
|
27
27
|
http_parser.rb (~> 0.6.0)
|
28
28
|
http-cookie (1.0.3)
|
29
29
|
domain_name (~> 0.5)
|
30
|
-
http-form_data (2.
|
30
|
+
http-form_data (2.2.0)
|
31
31
|
http_parser.rb (0.6.0)
|
32
|
-
json (2.2.0)
|
33
32
|
media_types (0.6.2)
|
34
|
-
minitest (5.
|
33
|
+
minitest (5.14.0)
|
35
34
|
minitest-ci (3.4.0)
|
36
35
|
minitest (>= 5.0.6)
|
37
36
|
minitest-reporters (1.4.2)
|
@@ -39,22 +38,21 @@ GEM
|
|
39
38
|
builder
|
40
39
|
minitest (>= 5.0)
|
41
40
|
ruby-progressbar
|
42
|
-
oj (3.10.
|
43
|
-
public_suffix (4.0.
|
41
|
+
oj (3.10.2)
|
42
|
+
public_suffix (4.0.3)
|
44
43
|
rake (13.0.1)
|
45
44
|
ruby-progressbar (1.10.1)
|
46
45
|
safe_yaml (1.0.5)
|
47
|
-
simplecov (0.
|
46
|
+
simplecov (0.18.0)
|
48
47
|
docile (~> 1.1)
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
trailer_vote-media_types (2.0.0)
|
48
|
+
simplecov-html (~> 0.11.0)
|
49
|
+
simplecov-html (0.11.0)
|
50
|
+
trailer_vote-media_types (2.3.0)
|
53
51
|
media_types (>= 0.6.0, < 1)
|
54
52
|
unf (0.1.4)
|
55
53
|
unf_ext
|
56
54
|
unf_ext (0.0.7.6)
|
57
|
-
webmock (3.
|
55
|
+
webmock (3.8.0)
|
58
56
|
addressable (>= 2.3.6)
|
59
57
|
crack (>= 0.3.2)
|
60
58
|
hashdiff (>= 0.4.0, < 2.0.0)
|
@@ -22,3 +22,5 @@ require 'trailer_vote/api/product/place/link'
|
|
22
22
|
require 'trailer_vote/api/product/video'
|
23
23
|
require 'trailer_vote/api/product/video/create'
|
24
24
|
require 'trailer_vote/api/product/video/find'
|
25
|
+
require 'trailer_vote/api/push_recipe_ios'
|
26
|
+
require 'trailer_vote/api/push_recipe_android'
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'trailer_vote/media_types'
|
4
|
+
|
5
|
+
module TrailerVote
|
6
|
+
module Api
|
7
|
+
class PushRecipeAndroid
|
8
|
+
include Composable::Get
|
9
|
+
|
10
|
+
attr_accessor :client
|
11
|
+
|
12
|
+
SUCCESS = MediaTypes::PushRecipeAndroid.to_constructable.version(1)
|
13
|
+
FAILURE = MediaTypes::Errors.to_constructable.version(1)
|
14
|
+
ACCEPT = [SUCCESS.to_s, FAILURE.to_s(0.1)].join(', ').freeze
|
15
|
+
|
16
|
+
def initialize(configuration: nil, result: nil)
|
17
|
+
self.configuration = configuration
|
18
|
+
self.result = result
|
19
|
+
end
|
20
|
+
|
21
|
+
def call(url: nil)
|
22
|
+
return self if ok? || !url
|
23
|
+
|
24
|
+
local_client = client
|
25
|
+
unless client
|
26
|
+
uri = URI(url)
|
27
|
+
local_client = TrailerVote::Api.default_unauthenticated_client
|
28
|
+
local_client = local_client.basic_auth(user: uri.user, pass: uri.password)
|
29
|
+
end
|
30
|
+
|
31
|
+
guard_network_errors do
|
32
|
+
branch(local_client.headers(Headers::ACCEPT => ACCEPT).get(url))
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
TrailerVote::MediaTypes::PushRecipeAndroid.register
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'trailer_vote/media_types'
|
4
|
+
|
5
|
+
module TrailerVote
|
6
|
+
module Api
|
7
|
+
class PushRecipeIos
|
8
|
+
include Composable::Get
|
9
|
+
|
10
|
+
attr_accessor :client
|
11
|
+
|
12
|
+
SUCCESS = MediaTypes::PushRecipeIos.to_constructable.version(1)
|
13
|
+
FAILURE = MediaTypes::Errors.to_constructable.version(1)
|
14
|
+
ACCEPT = [SUCCESS.to_s, FAILURE.to_s(0.1)].join(', ').freeze
|
15
|
+
|
16
|
+
def initialize(configuration: nil, result: nil)
|
17
|
+
self.configuration = configuration
|
18
|
+
self.result = result
|
19
|
+
end
|
20
|
+
|
21
|
+
def call(url: nil)
|
22
|
+
return self if ok? || !url
|
23
|
+
|
24
|
+
local_client = client
|
25
|
+
unless client
|
26
|
+
uri = URI(url)
|
27
|
+
local_client = TrailerVote::Api.default_unauthenticated_client
|
28
|
+
local_client = local_client.basic_auth(user: uri.user, pass: uri.password)
|
29
|
+
end
|
30
|
+
|
31
|
+
guard_network_errors do
|
32
|
+
branch(local_client.headers(Headers::ACCEPT => ACCEPT).get(url))
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
TrailerVote::MediaTypes::PushRecipeIos.register
|
data/lib/trailer_vote/api.rb
CHANGED
@@ -23,14 +23,17 @@ module TrailerVote
|
|
23
23
|
TypeRegistry[media_type.to_s].encode(data)
|
24
24
|
end
|
25
25
|
|
26
|
-
def
|
27
|
-
|
28
|
-
HTTP_KLAZZ.basic_auth(user: username, pass: password).headers(
|
26
|
+
def default_unauthenticated_client
|
27
|
+
HTTP_KLAZZ.headers(
|
29
28
|
Headers::ACCEPT_ENCODING => 'gzip, deflate; q=0.5, identity; q=0.1',
|
30
29
|
Headers::USER_AGENT => format('TrailerVote/httpx.rb (client %<version>s)', version: VERSION)
|
31
30
|
)
|
32
31
|
end
|
33
32
|
|
33
|
+
def default_client(username, password)
|
34
|
+
default_unauthenticated_client.basic_auth(user: username, pass: password)
|
35
|
+
end
|
36
|
+
|
34
37
|
module Headers
|
35
38
|
ACCEPT = 'Accept'
|
36
39
|
ACCEPT_ENCODING = 'Accept-Encoding'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: trailer_vote-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Derk-Jan Karrenbeld
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-01-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: http
|
@@ -223,6 +223,8 @@ files:
|
|
223
223
|
- lib/trailer_vote/api/product/video/create.rb
|
224
224
|
- lib/trailer_vote/api/product/video/find.rb
|
225
225
|
- lib/trailer_vote/api/product/video/urls.rb
|
226
|
+
- lib/trailer_vote/api/push_recipe_android.rb
|
227
|
+
- lib/trailer_vote/api/push_recipe_ios.rb
|
226
228
|
- lib/trailer_vote/api/type_registry.rb
|
227
229
|
- lib/trailer_vote/api/version.rb
|
228
230
|
- trailer_vote-api.gemspec
|