obecon-client 0.0.5 → 0.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b543e949b3c472a663f4dbdcedc0962e6220fa36
4
- data.tar.gz: dcc291c888adc9451adb10e0a9bbefdbb84a43aa
3
+ metadata.gz: c3c90d7fb08749a620ef602307151539348acf8e
4
+ data.tar.gz: 5113925a0805eea8ca7c0d8375eb08f76d4d6dc5
5
5
  SHA512:
6
- metadata.gz: 0a01b8091dea2bc8ae0e9ddfa099d8afd59d88ba9db6d059f3f42941d358fde6fb652c5d3c6eeef3b5c79148100228fecea6a571091e6f87f80e932cdee8339f
7
- data.tar.gz: 90d44df513911ffab8d78cd5d9d575b381fabbb42f473dae317afdc05b2a965604c3589535bff850d2440cffd5965e062c2c5b23546af870283a9b33517cfc6e
6
+ metadata.gz: 44ce9a2a364d937c82617d095cbec69596a566050ebf2c83a7c845a206f6bfa6a3864beddc95e83e4323da3794e1238e1b378a49651c2d36b4b07735a237d501
7
+ data.tar.gz: 8f63f50e0bf2e87568ba24a5c015df18a96bfb6f45f0af29408bde0d5f5d3b4fe2f1b67617a255ae5ceda38c8c5d418939b1c873fae5911680260e1d994b122f
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "hashie"
2
4
  require "httparty"
3
5
  require "uri"
@@ -8,10 +10,9 @@ require "obecon/response_wrapper"
8
10
  require "obecon/asset"
9
11
 
10
12
  module Obecon
11
-
12
13
  def new(options = {})
13
14
  Client.new(options)
14
15
  end
15
- module_function :new
16
16
 
17
+ module_function :new
17
18
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Obecon
2
4
  class Asset < Hashie::Mash
3
5
  end
@@ -1,54 +1,67 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Obecon
2
4
  class Client
3
5
  include HTTParty
6
+
4
7
  USER_AGENT = "ASK HELMUT Oberbaum Concept Client #{VERSION}"
5
- MOVIE_PARAM_NAME = "CMFilm-Id"
8
+ MOVIE_PARAM_NAME = "id"
6
9
  DEFAULT_OPTIONS = {
7
- site: "webs.sn.obecon.net"
8
- }
10
+ host: "www.rce-event.de",
11
+ path: "/api/filepool.php",
12
+ }.freeze
9
13
 
10
14
  attr_accessor :options
11
- headers({"User-Agent" => USER_AGENT})
15
+ headers("User-Agent" => USER_AGENT)
12
16
 
13
17
  def initialize(options = {})
14
18
  store_options(options)
15
- raise ArgumentError, "A domain name must be present" if domain_name.nil?
19
+ raise ArgumentError, "A token must be present" if token.nil?
16
20
  end
17
21
 
18
22
  def movie(movie_id)
19
- handle_response {
20
- self.class.get(*construct_query_arguments(MOVIE_PARAM_NAME, movie_id))
21
- }
23
+ handle_response do
24
+ self.class.get(build_query(movie_id)).body
25
+ end
22
26
  end
23
27
 
24
28
  # accessors for options
25
- def site
26
- @options[:site]
29
+
30
+ def host
31
+ @options[:host]
27
32
  end
28
- def domain_name
29
- @options[:domain_name]
33
+
34
+ def path
35
+ @options[:path]
30
36
  end
31
37
 
32
- def api_url
33
- [site, domain_name].join("/")
38
+ def token
39
+ @options[:token]
34
40
  end
35
41
 
36
42
  private
37
- def handle_response(&block)
38
- response = block.call
43
+
44
+ def handle_response
45
+ response = yield
39
46
  ResponseWrapper.new(response)
40
47
  end
41
48
 
42
- def store_options(options={})
49
+ def store_options(options = {})
43
50
  @options ||= DEFAULT_OPTIONS.dup
44
51
  @options.merge!(options)
45
52
  end
46
53
 
47
- def construct_query_arguments(detail_name, identifier)
48
- scheme = "http"
49
- [
50
- "#{scheme}://#{api_url}/#{detail_name}/#{identifier}"
51
- ]
54
+ def build_query(movie_id)
55
+ URI::HTTP.build(
56
+ host: host,
57
+ path: path,
58
+ query: URI.encode_www_form(
59
+ token: token,
60
+ mode: "event",
61
+ rceid: "0",
62
+ id: movie_id,
63
+ ),
64
+ ).to_s
52
65
  end
53
66
  end
54
67
  end
@@ -1,6 +1,7 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Obecon
2
4
  class ResponseWrapper
3
-
4
5
  RESULT = "result"
5
6
  ASSET = "asset"
6
7
  # SLOTS
@@ -9,22 +10,22 @@ module Obecon
9
10
  # BB*=459x400, jpg, rgb
10
11
  GALLERY = "fotostrecke"
11
12
 
12
- # Filmplakat
13
+ # Filmplakat
13
14
  # Filmplakat
14
15
  # BB*=400x10000, jpg, rgb
15
16
  POSTER = "filmplakat"
16
17
 
17
- # Filmbild
18
+ # Filmbild
18
19
  # teaser Image klein
19
20
  # BB*=180x10000, jpg, rgb
20
21
  TEASER_SMALL = "filmbild"
21
22
 
22
23
  # Splash
23
- # teaser Image groß
24
+ # teaser Image gross
24
25
  # BB*=456x340, jpg, rgb
25
26
  TEASER_LARGE = "splash"
26
27
 
27
- # webcontainer
28
+ # webcontainer
28
29
  # Event Content
29
30
  # BB*=456x340, jpg, rgb
30
31
  WEBCONTAINER = "webcontainer"
@@ -34,12 +35,12 @@ module Obecon
34
35
  # 456x340, 480kbit Video, flv
35
36
  VIDEO_HQ = "video_hq"
36
37
 
37
- # *(_small_hq)
38
+ # *(_small_hq)
38
39
  # Flash-Video
39
40
  # 180x132, 192kBit Video, flv
40
41
  VIDEO_SMALL_HQ = "video_small_hq"
41
42
 
42
- # *(_small_lq)
43
+ # *(_small_lq)
43
44
  # Flash-Video
44
45
  # 180x132, 64kBit Video, flv
45
46
  VIDEO_SMALL_LQ = "video_small_lq"
@@ -55,12 +56,13 @@ module Obecon
55
56
  @slot_map = map_by_slots(assets)
56
57
  end
57
58
 
58
- def method_missing(method_name, *args, &block)
59
+ def method_missing(method_name, *_args)
59
60
  mapped_slot = ResponseWrapper.const_get method_name.upcase
60
61
  @slot_map[mapped_slot.to_sym]
61
62
  end
62
63
 
63
64
  private
65
+
64
66
  def map_by_slots(array)
65
67
  result = {}
66
68
  array.each do |entry|
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module Obecon
2
- VERSION = '0.0.5'
4
+ VERSION = "0.1.0"
3
5
  end
metadata CHANGED
@@ -1,29 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: obecon-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.5
4
+ version: 0.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Niels Hoffmann
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-11 00:00:00.000000000 Z
11
+ date: 2018-03-12 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: httparty
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '0.12'
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: '0.12'
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: hashie
29
15
  requirement: !ruby/object:Gem::Requirement
@@ -39,7 +25,7 @@ dependencies:
39
25
  - !ruby/object:Gem::Version
40
26
  version: '2.0'
41
27
  - !ruby/object:Gem::Dependency
42
- name: simplecov
28
+ name: httparty
43
29
  requirement: !ruby/object:Gem::Requirement
44
30
  requirements:
45
31
  - - "~>"
@@ -52,48 +38,6 @@ dependencies:
52
38
  - - "~>"
53
39
  - !ruby/object:Gem::Version
54
40
  version: '0.12'
55
- - !ruby/object:Gem::Dependency
56
- name: bundler
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - "~>"
60
- - !ruby/object:Gem::Version
61
- version: '1.0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - "~>"
67
- - !ruby/object:Gem::Version
68
- version: '1.0'
69
- - !ruby/object:Gem::Dependency
70
- name: guard
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - "~>"
74
- - !ruby/object:Gem::Version
75
- version: '1.0'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - "~>"
81
- - !ruby/object:Gem::Version
82
- version: '1.0'
83
- - !ruby/object:Gem::Dependency
84
- name: rb-fsevent
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - "~>"
88
- - !ruby/object:Gem::Version
89
- version: '0.9'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - "~>"
95
- - !ruby/object:Gem::Version
96
- version: '0.9'
97
41
  description: Simple wrapper to receive assets from oberbaum-concept asset servers.
98
42
  email:
99
43
  - niels@askhelmut.com
@@ -127,9 +71,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
127
71
  version: 1.3.5
128
72
  requirements: []
129
73
  rubyforge_project:
130
- rubygems_version: 2.5.1
74
+ rubygems_version: 2.6.11
131
75
  signing_key:
132
76
  specification_version: 4
133
77
  summary: A wrapper for the Oberbaum Concept asset server.
134
78
  test_files: []
135
- has_rdoc: