sowprog-api-ruby 0.0.1

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.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/sowprog-api-ruby.rb +35 -0
  3. metadata +45 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: d8ff73e013ea69cabd26c8f0c8c114b05af14af949ec6c643a8b22e7a67f7a37
4
+ data.tar.gz: ac97f08229fa1c5973b8c395907a2f5512737cccc5ed05dd1551ab36f54f8396
5
+ SHA512:
6
+ metadata.gz: 5938683a7dfd5b1fc9215473518b97f938e3de2c283815b01532fee9290c33734662958d182d5523e131110a221536a1546847274c434ca0a0793c87c38e6371
7
+ data.tar.gz: 6dbf56e8b80e1a5690bf904f50c84f6edc431a75ecb8e3f050965cd601a50aac098861294a509bc7b09eb6cdfcd932c7b8bed189cd0dfa34378fb3691cbeed32
@@ -0,0 +1,35 @@
1
+ require 'uri'
2
+ require 'net/http'
3
+ require 'base64'
4
+ require 'json'
5
+
6
+ class SowprogApiRuby
7
+ class Configuration
8
+ attr_accessor :user_name, :password
9
+ end
10
+
11
+ def self.scheduled_events
12
+ url = URI('https://agenda.sowprog.com/rest/v1_2/scheduledEvents/search')
13
+ request = Net::HTTP::Get.new(url)
14
+ request["Accept"] = "application/json"
15
+ request["Content-Type"] = "application/json"
16
+ request["Authorization"] = "Basic " + Base64.encode64("#{SowprogApiRuby.configuration.user_name}:#{SowprogApiRuby.configuration.password}").strip
17
+ http = Net::HTTP.new(url.host, url.port)
18
+ http.use_ssl = true
19
+ response = http.request request
20
+ return JSON.parse(response.body)
21
+ end
22
+
23
+
24
+ def self.configuration
25
+ @configuration ||= Configuration.new
26
+ end
27
+
28
+ def self.configure(&block)
29
+ yield(configuration)
30
+ end
31
+
32
+ end
33
+
34
+ # SowprogApiRuby::ScheduledEvents.fetch
35
+ # SowprogApiRuby.scheduled_events
metadata ADDED
@@ -0,0 +1,45 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sowprog-api-ruby
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - LiveTonight
8
+ - Guillaume Blanchard
9
+ - Hugo How-Choong
10
+ autorequire:
11
+ bindir: bin
12
+ cert_chain: []
13
+ date: 2022-09-08 00:00:00.000000000 Z
14
+ dependencies: []
15
+ description: SowProg Api Ruby
16
+ email: hugo@livetonight.fr
17
+ executables: []
18
+ extensions: []
19
+ extra_rdoc_files: []
20
+ files:
21
+ - lib/sowprog-api-ruby.rb
22
+ homepage: https://rubygems.org/gems/sowprog-api-ruby
23
+ licenses:
24
+ - MIT
25
+ metadata: {}
26
+ post_install_message:
27
+ rdoc_options: []
28
+ require_paths:
29
+ - lib
30
+ required_ruby_version: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ required_rubygems_version: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: '0'
40
+ requirements: []
41
+ rubygems_version: 3.1.6
42
+ signing_key:
43
+ specification_version: 4
44
+ summary: SowProg Api Ruby
45
+ test_files: []