angie-core-api 0.2.3 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/angie-core-api.rb +4 -0
- data/lib/angie-core-api/client.rb +4 -7
- data/lib/angie-core-api/configuration.rb +2 -1
- data/lib/angie-core-api/delivery_method.rb +4 -2
- data/lib/angie-core-api/flight.rb +2 -0
- data/lib/angie-core-api/map.rb +2 -0
- data/lib/angie-core-api/message.rb +8 -0
- data/lib/angie-core-api/message/client.rb +25 -0
- data/lib/angie-core-api/message/queue.rb +30 -0
- data/lib/angie-core-api/notification.rb +2 -0
- data/lib/angie-core-api/railtie.rb +2 -0
- data/lib/angie-core-api/tv.rb +13 -0
- data/lib/angie-core-api/weather.rb +2 -0
- metadata +46 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6b4884c3195b5668cb61d7ed20fd97fa0c08209bc2b129ab45f9c776a5ce2ba0
|
4
|
+
data.tar.gz: ecb5fdcbfc17ddb640a9105f33802ba7ad49bc5341e1f815a9484ea06d085159
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0bb6bc79455a2b6c82bdad9e375e1507762267d1d81a6e2d22faf51d950d6b49170d1161dcb0527c918ada83aadcdae4adb0de4053279682672fb5f96f6c9097
|
7
|
+
data.tar.gz: 2efd6d4c9a2de953368ab1a252c439e247dc0041b4cd5a74792e175656cdf12dc28c46f2f3beccb940e9c9f1ab59294433c6090f2d2600c347978ea113fdbd52
|
data/lib/angie-core-api.rb
CHANGED
@@ -1,11 +1,15 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module AngieCoreApi
|
2
4
|
autoload :Configuration, "angie-core-api/configuration"
|
3
5
|
autoload :Client, "angie-core-api/client"
|
4
6
|
autoload :Flight, "angie-core-api/flight"
|
5
7
|
autoload :Map, "angie-core-api/map"
|
6
8
|
autoload :Notification, "angie-core-api/notification"
|
9
|
+
autoload :TV, "angie-core-api/tv"
|
7
10
|
autoload :Weather, "angie-core-api/weather"
|
8
11
|
autoload :DeliveryMethod, "angie-core-api/delivery_method"
|
12
|
+
autoload :Message, "angie-core-api/message"
|
9
13
|
|
10
14
|
def self.configuration
|
11
15
|
@configuration ||= Configuration.new
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "httparty"
|
2
4
|
|
3
5
|
module AngieCoreApi
|
@@ -9,9 +11,9 @@ module AngieCoreApi
|
|
9
11
|
def data(http_method, url, body = {})
|
10
12
|
case http_method
|
11
13
|
when :get
|
12
|
-
|
14
|
+
get(api_url_for(url), headers: api_headers)
|
13
15
|
when :post
|
14
|
-
|
16
|
+
post(api_url_for(url), body: body.to_json, headers: api_headers)
|
15
17
|
end
|
16
18
|
end
|
17
19
|
|
@@ -36,11 +38,6 @@ module AngieCoreApi
|
|
36
38
|
self.class.default_options[:timeout] || self.class.default_options[:read_timeout]
|
37
39
|
end
|
38
40
|
|
39
|
-
def parsed_response
|
40
|
-
response = yield
|
41
|
-
response.code == 200 ? response.parsed_response : nil
|
42
|
-
end
|
43
|
-
|
44
41
|
def get(url, headers: api_headers, timeout: default_timeout)
|
45
42
|
request(:get, url, headers: headers, timeout: timeout)
|
46
43
|
end
|
@@ -1,16 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
module AngieCoreApi
|
2
4
|
class DeliveryMethod
|
3
5
|
def initialize(mail) end
|
4
6
|
|
5
7
|
def deliver!(mail)
|
6
8
|
Notification.email(
|
7
|
-
from: mail.from,
|
9
|
+
from: mail.from.first,
|
8
10
|
to: mail.to,
|
9
11
|
cc: mail.cc,
|
10
12
|
bcc: mail.bcc,
|
11
13
|
subject: mail.subject,
|
12
14
|
text: mail.text_part ? mail.text_part.body&.raw_source : mail.body.raw_source,
|
13
|
-
html: mail.html_part
|
15
|
+
html: mail.html_part ? mail.html_part.body&.raw_source : mail.body.raw_source
|
14
16
|
)
|
15
17
|
end
|
16
18
|
end
|
data/lib/angie-core-api/map.rb
CHANGED
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "stomp"
|
4
|
+
|
5
|
+
module AngieCoreApi
|
6
|
+
module Message
|
7
|
+
class Client
|
8
|
+
include Concurrent::Async
|
9
|
+
|
10
|
+
def initialize
|
11
|
+
config = HashWithIndifferentAccess.new(AngieCoreApi.configuration.activemq)
|
12
|
+
@client = Stomp::Client.new(config)
|
13
|
+
end
|
14
|
+
|
15
|
+
def publish(queue, data)
|
16
|
+
@client.publish(queue, data.to_json)
|
17
|
+
@client.close
|
18
|
+
end
|
19
|
+
|
20
|
+
def subscribe(queue)
|
21
|
+
@client.subscribe(queue) { |msg| yield JSON.parse(msg.body) }
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module AngieCoreApi
|
4
|
+
module Message
|
5
|
+
class Queue
|
6
|
+
def self.classes
|
7
|
+
Dir["app/queues/*.rb"].
|
8
|
+
map { |file| File.basename(file, ".rb") }.
|
9
|
+
select { |type| type != "application_queue" }.
|
10
|
+
map(&:camelize).
|
11
|
+
map(&:constantize)
|
12
|
+
end
|
13
|
+
|
14
|
+
def self.queue
|
15
|
+
path = name.underscore.sub("_queue", "")
|
16
|
+
"/queue/#{path}"
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.publish(message)
|
20
|
+
Client.new.async.publish(queue, message)
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.subscribe
|
24
|
+
Client.new.async.subscribe(queue) do |message|
|
25
|
+
self.new.receive(message)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
metadata
CHANGED
@@ -1,57 +1,85 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: angie-core-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Angie Hospitality
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-03-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: actioncable
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: '6.1'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: '6.1'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: actionmailer
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '6.1'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '6.1'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: activesupport
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
30
44
|
requirements:
|
31
45
|
- - "~>"
|
32
46
|
- !ruby/object:Gem::Version
|
33
|
-
version: '6.
|
47
|
+
version: '6.1'
|
34
48
|
type: :runtime
|
35
49
|
prerelease: false
|
36
50
|
version_requirements: !ruby/object:Gem::Requirement
|
37
51
|
requirements:
|
38
52
|
- - "~>"
|
39
53
|
- !ruby/object:Gem::Version
|
40
|
-
version: '6.
|
54
|
+
version: '6.1'
|
41
55
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
56
|
+
name: httparty
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 0.18.1
|
62
|
+
type: :runtime
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 0.18.1
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: stomp
|
43
71
|
requirement: !ruby/object:Gem::Requirement
|
44
72
|
requirements:
|
45
73
|
- - "~>"
|
46
74
|
- !ruby/object:Gem::Version
|
47
|
-
version: '
|
75
|
+
version: '1.4'
|
48
76
|
type: :runtime
|
49
77
|
prerelease: false
|
50
78
|
version_requirements: !ruby/object:Gem::Requirement
|
51
79
|
requirements:
|
52
80
|
- - "~>"
|
53
81
|
- !ruby/object:Gem::Version
|
54
|
-
version: '
|
82
|
+
version: '1.4'
|
55
83
|
description: Angie CoreAPI Ruby gem
|
56
84
|
email:
|
57
85
|
- rubygems@angie.ai
|
@@ -65,14 +93,18 @@ files:
|
|
65
93
|
- lib/angie-core-api/delivery_method.rb
|
66
94
|
- lib/angie-core-api/flight.rb
|
67
95
|
- lib/angie-core-api/map.rb
|
96
|
+
- lib/angie-core-api/message.rb
|
97
|
+
- lib/angie-core-api/message/client.rb
|
98
|
+
- lib/angie-core-api/message/queue.rb
|
68
99
|
- lib/angie-core-api/notification.rb
|
69
100
|
- lib/angie-core-api/railtie.rb
|
101
|
+
- lib/angie-core-api/tv.rb
|
70
102
|
- lib/angie-core-api/weather.rb
|
71
103
|
homepage: https://angie.ai
|
72
104
|
licenses: []
|
73
105
|
metadata:
|
74
106
|
homepage_uri: https://angie.ai
|
75
|
-
post_install_message:
|
107
|
+
post_install_message:
|
76
108
|
rdoc_options: []
|
77
109
|
require_paths:
|
78
110
|
- lib
|
@@ -87,8 +119,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
87
119
|
- !ruby/object:Gem::Version
|
88
120
|
version: '0'
|
89
121
|
requirements: []
|
90
|
-
rubygems_version: 3.
|
91
|
-
signing_key:
|
122
|
+
rubygems_version: 3.1.4
|
123
|
+
signing_key:
|
92
124
|
specification_version: 4
|
93
125
|
summary: Angie CoreAPI Ruby gem
|
94
126
|
test_files: []
|