globelabs_sms_rails 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: 0c7d30ff0715a5ce9fa4b20eaae6f95bca5c99eb
4
- data.tar.gz: 353850da1b66505589e3fc9aa6f06031936938d1
3
+ metadata.gz: 0ed0b2bc27b6f7bad6408a8f1c7fc8eb76c0528f
4
+ data.tar.gz: 68e967beb830ff3d4c7f22533204649b20ba3133
5
5
  SHA512:
6
- metadata.gz: a624a77fb31c3eceb7edbbb4a6d01f21449b7269975f8ff4e1151555187b631b7d9ddbbd1cfb21e62b4e9fb390726f27a19acf25a2dee5eed19f7a9df9fe5168
7
- data.tar.gz: 73f2fccbafebf21693278a82943626c79de37ac2d5a7e1929674c16c1d0517bc16f7acc5bfb17bb24d168b539b5dc6196128c46be9f321b3c6683c97010c8f7c
6
+ metadata.gz: ccf3b7746fa0a076c0814eddd39e19e3efe9eb82e0df4e32c414b515733dfc85f1fbed735dfa8d5e25e7669138d9968fdac344b58a49223bc59afa660d24076a
7
+ data.tar.gz: d773b3e3647124bffe269d2235988bcfceabf74ccc1c12b107dea1c4c55aafbcad0fe963471643c9580ebd7d0607249089b6de668f879e0c024703d89a29fca4
data/.gitignore CHANGED
@@ -6,4 +6,5 @@
6
6
  /doc/
7
7
  /pkg/
8
8
  /spec/reports/
9
+ /spec/globelabs_sms_rails_spec.rb.template
9
10
  /tmp/
@@ -1,3 +1,6 @@
1
+ require "uri"
2
+ require "net/https"
3
+ require "json"
1
4
  require "globelabs_sms_rails/version"
2
5
 
3
6
  module GlobelabsSmsRails
@@ -25,23 +28,36 @@ module GlobelabsSmsRails
25
28
  end
26
29
  end
27
30
 
28
- def self.send_message(address, message)
31
+ def self.send_message(address, message, customCred=nil)
29
32
  @address = address
30
33
  @message = message
31
34
 
32
35
  if @address.nil? || @message.nil?
33
36
  raise 'Address or message is nil'
34
37
  else
38
+ unless customCred.nil?
39
+ appId = customCred[:app_id]
40
+ appSecret = customCred[:app_secret]
41
+ passPhrase = customCred[:passphrase]
42
+ shortCode = customCred[:short_code]
43
+ else
44
+ appId = self.configuration.app_id
45
+ appSecret = self.configuration.app_secret
46
+ passPhrase = self.configuration.passphrase
47
+ shortCode = self.configuration.short_code
48
+ end
49
+
35
50
  data = {
36
51
  address: @address,
37
52
  message: @message,
38
- app_id: self.configuration.app_id,
39
- app_secret: self.configuration.app_secret,
40
- passphrase: self.configuration.passphrase
53
+ app_id: appId,
54
+ app_secret: appSecret,
55
+ passphrase: passPhrase
41
56
  }
42
- uri = URI.parse("https://devapi.globelabs.com.ph/smsmessaging/#{self.configuration.api_version}/outbound/#{self.configuration.short_code}/requests")
57
+
58
+ uri = URI.parse("https://devapi.globelabs.com.ph/smsmessaging/#{self.configuration.api_version}/outbound/#{shortCode}/requests")
43
59
  res = Net::HTTP.post_form(uri, data)
44
- puts "#{data}"
60
+
45
61
  return JSON.parse(res.body).merge(http_code: res.code)
46
62
  end
47
63
  end
@@ -1,3 +1,3 @@
1
1
  module GlobelabsSmsRails
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: globelabs_sms_rails
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
  - Nujian Den Mark Meralpis
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-09-05 00:00:00.000000000 Z
11
+ date: 2017-09-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -93,7 +93,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
93
93
  version: '0'
94
94
  requirements: []
95
95
  rubyforge_project:
96
- rubygems_version: 2.4.8
96
+ rubygems_version: 2.6.13
97
97
  signing_key:
98
98
  specification_version: 4
99
99
  summary: Sending SMS using Globe Labs API.