cameratag-ruby-api-client 0.0.1.beta

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 7c8103e93bfb36d4de6050598576ea58332abb135b2103584784ebb5a8b24f3d
4
+ data.tar.gz: d7aee2768d72d2cd1be3a268dafa8b056073598e161ad85519c4b3be645dc6e0
5
+ SHA512:
6
+ metadata.gz: 12a7e3ddafa6138a5784c66c31ab35fa460c64474ef359ea0cfc5e3f52ab1b6fda81731d3bbd73ba88f7e17a06b87c1c402d3ea57951aa69e0e31f1c6eede20c
7
+ data.tar.gz: b91500a079885d3ad4e87cd816747a920632344fc6357b3f1b3558813f7c318c1914fedd092b205c9ce593d7b2f354e2404b42d590a5f2033615119f42d90658
data/lib/cameratag.rb ADDED
@@ -0,0 +1,38 @@
1
+ require 'cameratag/configuration'
2
+
3
+ module Cameratag
4
+ class << self
5
+
6
+ def videos
7
+ assets({type: "video"})
8
+ end
9
+
10
+ def audios
11
+ assets({type: "audio"})
12
+ end
13
+
14
+ def photos
15
+ assets({type: "photo"})
16
+ end
17
+
18
+ def assets(**params)
19
+ get("apps/#{config.app_id}/assets", "assets", params)
20
+ end
21
+
22
+ def apps(**params)
23
+ get("apps", "cameras", params)
24
+ end
25
+
26
+ def get(rest_path, response_array_key, **params)
27
+ url = "#{full_path}/#{rest_path}.json"
28
+ uri = URI(url)
29
+ uri.query = URI.encode_www_form(params.merge({api_key: config.api_key}))
30
+ res = Net::HTTP.get_response(uri)
31
+ apps = JSON.parse(res.body)[response_array_key]
32
+ end
33
+
34
+ def full_path
35
+ "https://cameratag.com/api/v13"
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,14 @@
1
+ module Cameratag
2
+ class << self
3
+ attr_accessor :config
4
+ end
5
+
6
+ def self.configure
7
+ self.config ||= Configuration.new
8
+ yield(config)
9
+ end
10
+
11
+ class Configuration
12
+ attr_accessor :api_key, :app_id
13
+ end
14
+ end
metadata ADDED
@@ -0,0 +1,44 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: cameratag-ruby-api-client
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1.beta
5
+ platform: ruby
6
+ authors:
7
+ - Nik Pyatov
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2020-07-31 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: Simple gem for use API CameraTag
14
+ email: ctulhuweb@gmail.com
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - lib/cameratag.rb
20
+ - lib/cameratag/configuration.rb
21
+ homepage: https://rubygems.org/gems/cameratag-ruby-api-client
22
+ licenses:
23
+ - Nonstandard
24
+ metadata: {}
25
+ post_install_message:
26
+ rdoc_options: []
27
+ require_paths:
28
+ - lib
29
+ required_ruby_version: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ required_rubygems_version: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - ">"
37
+ - !ruby/object:Gem::Version
38
+ version: 1.3.1
39
+ requirements: []
40
+ rubygems_version: 3.0.3
41
+ signing_key:
42
+ specification_version: 4
43
+ summary: Cameratag
44
+ test_files: []