globe_connect 1.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.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 463634dd62d7e8a229ed0213c8e3eddf3a7e037c
4
+ data.tar.gz: ee638aa8e9851a2774f6ab7f2620a025dccfe894
5
+ SHA512:
6
+ metadata.gz: 063d53db5087285324dd6667655ae9ae9f0509bea5f5e09f0806ce860d8ab3e1fe5bbab1eb71710a3abf86024a7a802c6f6aecd7e21a1f1bf40dc699235782f7
7
+ data.tar.gz: 4b1bcb19ba2b1c72f735f5157469517f56e68c758469502c5debbb367c377a2998d8b42403306871193065609f7341bd3793c21dae275ef8129a82fd7e8c46f9
@@ -0,0 +1,11 @@
1
+ /.bundle/
2
+ /.yardoc
3
+ /Gemfile.lock
4
+ /_yardoc/
5
+ /coverage/
6
+ /doc/
7
+ /pkg/
8
+ /spec/reports/
9
+ /tmp/
10
+ /spec/
11
+ .rspec
@@ -0,0 +1,74 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, gender identity and expression, level of experience,
9
+ nationality, personal appearance, race, religion, or sexual identity and
10
+ orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at rmaglayon@gmail.com. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at [http://contributor-covenant.org/version/1/4][version]
72
+
73
+ [homepage]: http://contributor-covenant.org
74
+ [version]: http://contributor-covenant.org/version/1/4/
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in connect_ruby.gemspec
4
+ gemspec
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Rico Maglayon
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
@@ -0,0 +1,131 @@
1
+ # Globe Connect for Ruby
2
+
3
+ ## Introduction
4
+ Globe Connect for Ruby platform provides an implementation of Globe APIs e.g Authentication, Amax,
5
+ Sms etc. that is easy to use and can be integrated in your existing Ruby application. Below shows
6
+ some samples on how to use the API depending on the functionality that you need to integrate in your
7
+ application.
8
+
9
+ ## Basic Usage
10
+
11
+ ###### Figure 1. Authentication
12
+
13
+ ```ruby
14
+ require 'globe_connect'
15
+
16
+ authenticate = Authentication.new
17
+ url = authenticate.get_access_url('[APP ID]')
18
+
19
+ response = authenticate.get_access_token('[APP ID]', '[APP_SECRET]', '[CODE]')
20
+
21
+ puts response
22
+ ```
23
+
24
+ ###### Figure 2. Amax
25
+
26
+ ```ruby
27
+ require 'globe_connect'
28
+
29
+ amax = Amax.new('[APP ID]', '[APP SECRET]')
30
+ response = amax.send_reward_request('[ADDRESS]', '[PROMO NAME]', '[TOKEN]')
31
+
32
+ puts response
33
+ ```
34
+
35
+ ###### Figure 3. Binary SMS
36
+
37
+ ```ruby
38
+ require 'globe_connect'
39
+
40
+ binary = Sms.new('[ACCESS TOKEN]', [SHORT CODE])
41
+ response = binary.send_binary_message('[ADDRESS]', '[MESSAGE]', '[USER DATA HEADER]')
42
+
43
+ puts response
44
+ ```
45
+
46
+ ###### Figure 4. Location
47
+
48
+ ```ruby
49
+ require 'globe_connect'
50
+
51
+ location = LocationQuery.new('[ACCESS TOKEN]')
52
+ response = location.get_location('[ADDRESS]', [ACCURACY])
53
+
54
+ puts response
55
+ ```
56
+
57
+ ###### Figure 5. Payment (Send Payment Request)
58
+
59
+ ```ruby
60
+ require 'globe_connect'
61
+
62
+ payment = Payment.new('[APP ID]', '[APP SECRET]', '[ACCESS TOKEN]')
63
+
64
+ response = payment.send_payment_request([AMOUNT], '[DESCRIPTION]', '[ADDRESS]', '[END USER ID]', '[TRANSACTION OPERATION STATUS]')
65
+
66
+ puts response
67
+ ```
68
+
69
+ ###### Figure 6. Payment (Get Last Reference ID)
70
+
71
+ ```ruby
72
+ require 'globe_connect'
73
+
74
+ payment = Payment.new('[APP ID]', '[APP SECRET]')
75
+ response = payment.get_last_reference_code
76
+
77
+ puts response
78
+ ```
79
+
80
+ ###### Figure 7. Sms
81
+
82
+ ```ruby
83
+ require 'globe_connect'
84
+
85
+ sms = Sms.new('[ACCESS TOKEN]', [SHORT CODE])
86
+ response = sms.send_message('[ADDRESS]', '[MESSAGE]')
87
+
88
+ puts response
89
+ ```
90
+
91
+ ###### Figure 8. Subscriber (Get Balance)
92
+
93
+ ```ruby
94
+ require 'globe_connect'
95
+
96
+ subscriber = Subscriber.new('[ACCESS TOKEN]')
97
+ response = subscriber.get_subscriber_balance('[ADDRESS]')
98
+
99
+ puts response
100
+ ```
101
+
102
+ ###### Figure 9. Subscriber (Get Reload Amount)
103
+
104
+ ```ruby
105
+ require 'globe_connect'
106
+
107
+ subscriber = Subscriber.new('[ACCESS TOKEN]')
108
+ response = subscriber.get_subscriber_reload_amount('[ADDRESS]')
109
+ ```
110
+
111
+ ###### Figure 10. USSD (Send)
112
+
113
+ ```ruby
114
+ require 'globe_connect'
115
+
116
+ ussd = Ussd.new('[ACCESS TOKEN]', [SHORT CODE])
117
+ response = ussd.send_ussd_request('[ADDRESS]', '[MESSAGE]', [FLASH])
118
+
119
+ puts response
120
+ ```
121
+
122
+ ###### Figure 11. USSD (Reply)
123
+
124
+ ```ruby
125
+ require 'globe_connect'
126
+
127
+ ussd = Ussd.new('[ACCESS TOKEN]', [SHORT CODE])
128
+ response = ussd.reply_ussd_request('[ADDRESS]', '[MESSAGE]', '[SESSION ID]', [FLASH])
129
+
130
+ puts response
131
+ ```
@@ -0,0 +1,2 @@
1
+ require "bundler/gem_tasks"
2
+ task :default => :spec
@@ -0,0 +1,121 @@
1
+ ### AMAX
2
+ ```ruby
3
+ require 'connect_ruby'
4
+
5
+ amax = Amax.new('5ozgSgeRyeHzacXo55TR65HnqoAESbAz', '3dbcd598f268268e13550c87134f8de0ec4ac1100cf0a68a2936d07fc9e2459e')
6
+ response = amax.send_reward_request('9271223448', 'LOAD 50', 'token')
7
+
8
+ puts response
9
+ ```
10
+
11
+ ### Authentication
12
+ ```ruby
13
+ require 'connect_ruby'
14
+
15
+ authenticate = Authentication.new
16
+ url = authenticate.get_access_url('5ozgSgeRyeHzacXo55TR65HnqoAESbAz')
17
+
18
+ print url
19
+
20
+ response = authenticate
21
+ .get_access_token(
22
+ '5ozgSgeRyeHzacXo55TR65HnqoAESbAz',
23
+ '3dbcd598f268268e13550c87134f8de0ec4ac1100cf0a68a2936d07fc9e2459e',
24
+ 'M8s6gAarub9pebhgEAqKsxdByxHoM5kzf4Mp5js98Bzot8bqjrfaRdG4H4jknpFzr8gKtdx4jnUqbA8KsxqA48frR698IKLRb5S5LBxauo9EkxCMrzk6uorxGEu67Tay49aTxxzu8ozznukMEaXCBRB8GuKjR5MSpB65zIbkA8Bf5eA94se848KUb589RteGkdEFBEddEH6xqRyfjMBqatE4ppBsAe56Bfq4BkjHrXA9Rsqzp5RhMAA6Mu65MAds'
25
+ )
26
+
27
+ puts response
28
+ ```
29
+
30
+ ### Location
31
+ ```ruby
32
+ require 'connect_ruby'
33
+
34
+ location = LocationQuery.new('kk_my8_77bTbW48zi4ap6SlE4UuybXq_XAsE79IGwhA')
35
+ response = location.get_location('09271223448', 10)
36
+
37
+ puts response
38
+ ```
39
+
40
+ ### Payment (Send Payment Request)
41
+ ```ruby
42
+ require 'connect_ruby'
43
+
44
+ payment = Payment.new(
45
+ '5ozgSgeRyeHzacXo55TR65HnqoAESbAz',
46
+ '3dbcd598f268268e13550c87134f8de0ec4ac1100cf0a68a2936d07fc9e2459e',
47
+ 'kk_my8_77bTbW48zi4ap6SlE4UuybXq_XAsE79IGwhA'
48
+ )
49
+
50
+ response = payment.send_payment_request(0.00, 'My Application', '9271223448', '41301000116', 'Charged')
51
+
52
+ puts response
53
+ ```
54
+
55
+ ### Payment (Get Last Reference Code)
56
+ ```ruby
57
+ require 'connect_ruby'
58
+
59
+ payment = Payment.new('5ozgSgeRyeHzacXo55TR65HnqoAESbAz', '3dbcd598f268268e13550c87134f8de0ec4ac1100cf0a68a2936d07fc9e2459e')
60
+ response = payment.get_last_reference_code
61
+
62
+ puts response
63
+ ```
64
+
65
+ ### SMS (Send Message)
66
+ ```ruby
67
+ require 'connect_ruby'
68
+
69
+ sms = Sms.new('kk_my8_77bTbW48zi4ap6SlE4UuybXq_XAsE79IGwhA', 21584130)
70
+ response = sms.send_message('+639271223448', 'Lorem ipsum')
71
+
72
+ puts response
73
+ ```
74
+
75
+ ### SMS (Binary Message)
76
+ ```ruby
77
+ require 'connect_ruby'
78
+
79
+ binary = Sms.new('kk_my8_77bTbW48zi4ap6SlE4UuybXq_XAsE79IGwhA', 21584130)
80
+ response = binary.send_binary_message('09271223448', 'Lorem ipsum', '06050423F423F4')
81
+
82
+ puts response
83
+ ```
84
+
85
+ ### Subscriber (Get Subscriber Balance)
86
+ ```ruby
87
+ require 'connect_ruby'
88
+
89
+ subscriber = Subscriber.new('kk_my8_77bTbW48zi4ap6SlE4UuybXq_XAsE79IGwhA')
90
+ response = subscriber.get_subscriber_balance('639271223448')
91
+
92
+ puts response
93
+ ```
94
+
95
+ ### Subscriber (Get Subscriber Reload Amount)
96
+ ```ruby
97
+ require 'connect_ruby'
98
+
99
+ subscriber = Subscriber.new('kk_my8_77bTbW48zi4ap6SlE4UuybXq_XAsE79IGwhA')
100
+ response = subscriber.get_subscriber_reload_amount('639271223448')
101
+ ```
102
+
103
+ ### USSD (Send USSD Request)
104
+ ```ruby
105
+ require 'connect_ruby'
106
+
107
+ ussd = Ussd.new('kk_my8_77bTbW48zi4ap6SlE4UuybXq_XAsE79IGwhA', 21584130)
108
+ response = ussd.send_ussd_request('639271223448', 'Simple USSD Message\nOption - 1\nOption - 2', false)
109
+
110
+ puts response
111
+ ```
112
+
113
+ ### USSD (Reply USSD Request)
114
+ ```ruby
115
+ require 'connect_ruby'
116
+
117
+ ussd = Ussd.new('kk_my8_77bTbW48zi4ap6SlE4UuybXq_XAsE79IGwhA', 21584130)
118
+ response = ussd.reply_ussd_request('639271223448', 'Simple USSD Message\nOption - 1\nOption - 2', '012345678912', false)
119
+
120
+ puts response
121
+ ```
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "globe_connect"
5
+
6
+ # You can add fixtures and/or initialization code here to make experimenting
7
+ # with your gem easier. You can also use a different console, if you like.
8
+
9
+ # (If you use this, don't forget to add pry to your Gemfile!)
10
+ # require "pry"
11
+ # Pry.start
12
+
13
+ require "irb"
14
+ IRB.start
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,41 @@
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'globe_connect/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "globe_connect"
8
+ spec.version = GlobeConnect::VERSION
9
+ spec.authors = ["Rico Maglayon"]
10
+ spec.email = ["rmaglayon@gmail.com"]
11
+
12
+ spec.summary = %q{Globe Connect for Ruby.}
13
+ spec.description = %q{Globe Connect for Ruby platform provides an implementation of Globe APIs e.g Authentication, Amax,
14
+ Sms etc. that is easy to use and can be integrated in your existing Ruby application. Below shows
15
+ some samples on how to use the API depending on the functionality that you need to integrate in your
16
+ application.}
17
+ spec.homepage = "http://globelabs.com.ph"
18
+ spec.license = "MIT"
19
+
20
+ # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
21
+ # to allow pushing to a single host or delete this section to allow pushing to any host.
22
+ # if spec.respond_to?(:metadata)
23
+ # spec.metadata['allowed_push_host'] = "http://mygemserver.com"
24
+ # else
25
+ # raise "RubyGems 2.0 or newer is required to protect against " \
26
+ # "public gem pushes."
27
+ # end
28
+
29
+ spec.files = `git ls-files -z`.split("\x0").reject do |f|
30
+ f.match(%r{^(test|spec|features)/})
31
+ end
32
+ spec.bindir = "exe"
33
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
34
+ spec.require_paths = ["lib"]
35
+
36
+ spec.required_ruby_version = '~> 2.0'
37
+
38
+ spec.add_development_dependency "bundler", "~> 1.13"
39
+ spec.add_development_dependency "rake", "~> 10.0"
40
+ spec.add_development_dependency "rspec", "~> 3.5"
41
+ end