pushould 0.0.3 → 0.0.4

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: 30a4745dd6024536a5dfb4a1dbda423c813b0e05
4
- data.tar.gz: 51d333c259890f55e304d83066f94f8522d97848
3
+ metadata.gz: 29f9beefb8f9d6b294add337c5b493583965c1bf
4
+ data.tar.gz: 11e3e4906057d17ebd8ce68f1624eb126043e727
5
5
  SHA512:
6
- metadata.gz: 7e9634f96152e3af2c7d0dc496073bd95bcb49d464780a3c6fb8582199f3eadb2469612c1ab9922620c17550224db2c79e245d954c0b3e0a0f199a3564e2bcc5
7
- data.tar.gz: b15722b1bd75efebff5f03b905db5e1a7030647c889136725db9d51f86a7370de0cc8895a5648c0efe39e45aef5a5bd5da1522f544b62e2d500c3dd5070b6dbd
6
+ metadata.gz: 8d2ddebe2d37a8a84a9312385f6fbbf32d25cb83404a468d87c47d7afd3b7614d93b01330bb5e19a3d518d8318563b0fe4be0f7308ab094db7084ea4400d8eed
7
+ data.tar.gz: d7c0d962e9a7cc369296c687014581e930e8d33776127a08e1a9e3eabcf6ce2cd5fe174ed1f11308f158c6d3ac53261b4a80e27fbbabae4acec4f92ce3e1f574
data/lib/pushould.rb CHANGED
@@ -2,5 +2,33 @@ require "pushould/version"
2
2
  require "pushould/cli"
3
3
 
4
4
  module Pushould
5
- # Your code goes here...
5
+ class Client
6
+ attr_reader :url, :token, :email, :password
7
+
8
+ def initialize(_url, token, _email, _password)
9
+ @url = _url
10
+ @token = token
11
+ @email = _email
12
+ @password = _password
13
+ end
14
+
15
+ def trigger(room: _room, event: _event, data: _data)
16
+ account_info = { email: @email, password: @password }.to_json
17
+ data = { room: room,
18
+ event: event,
19
+ token: @token,
20
+ custom: data
21
+ }.to_json
22
+ RestClient::Resource.new(@url, verify_ssl: OpenSSL::SSL::VERIFY_NONE).get(params: { account: account_info, data: data }, content_type: 'application/json', accept: 'application/json')
23
+ end
24
+ end
25
+
26
+ def self.new(args = {})
27
+ raise ArgumentError if args[:url].nil?
28
+ raise ArgumentError if args[:server_token].nil?
29
+ raise ArgumentError if args[:email].nil?
30
+ raise ArgumentError if args[:password].nil?
31
+
32
+ Pushould::Client.new(args[:url], args[:server_token], args[:email], args[:password])
33
+ end
6
34
  end
@@ -1,3 +1,3 @@
1
1
  module Pushould
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pushould
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yu Hoshino