sens_sms 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 6fa05df41402add0b0ee127b051364409ed24a1b
4
+ data.tar.gz: 0b8fe24b65c7f8235494dd978893fb82b3786dc4
5
+ SHA512:
6
+ metadata.gz: 5534a06d7257bbb9eaae699bf0917c30fd47a37d96af4002d13a9ed2a297e2504ca30ad46a9611c51d6b1e60f0837213eb606a140a474e2887a41f27459cbbdb
7
+ data.tar.gz: 91f413bbca39dd836507d8b3509786a5ac328bf823142430361e4f31dbe89a4dabc26d0ca8cccf93719674d35b87c514e584b20a0c0c8fd2b3a8e0cab1cec37f
@@ -0,0 +1,36 @@
1
+ name: Release
2
+ on:
3
+ release:
4
+ types:
5
+ - published
6
+ jobs:
7
+ release:
8
+ runs-on: ubuntu-latest
9
+ steps:
10
+ - name: Checkout code
11
+ uses: actions/checkout@v2
12
+ - name: Set up Ruby 2.4
13
+ uses: actions/setup-ruby@v1
14
+ with:
15
+ ruby-version: 2.4.x
16
+ - name: Publish to GitHub Package Registry
17
+ run: |
18
+ mkdir -p $HOME/.gem
19
+ touch $HOME/.gem/credentials
20
+ chmod 0600 $HOME/.gem/credentials
21
+ printf -- "---\n:github: Bearer ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
22
+ gem build *.gemspec
23
+ gem push --KEY github --host https://rubygems.pkg.github.com/${OWNER} *.gem
24
+ env:
25
+ GEM_HOST_API_KEY: ${{ secrets.GITHUB_ACCESS_TOKEN }}
26
+ OWNER: say8425
27
+ - name: Publish to RubyGems
28
+ run: |
29
+ mkdir -p $HOME/.gem
30
+ touch $HOME/.gem/credentials
31
+ chmod 0600 $HOME/.gem/credentials
32
+ printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
33
+ gem build *.gemspec
34
+ gem push *.gem
35
+ env:
36
+ GEM_HOST_API_KEY: ${{ secrets.RUBYGEMS_AUTH_TOKEN }}
@@ -0,0 +1,64 @@
1
+ name: Test
2
+ on:
3
+ push:
4
+ jobs:
5
+ Rubocop:
6
+ runs-on: ubuntu-latest
7
+ strategy:
8
+ matrix:
9
+ ruby: [2.4.x, 2.5.x, 2.6.x, 2.7.x]
10
+ steps:
11
+ - name: Checkout code
12
+ uses: actions/checkout@v2
13
+ - name: Set up Ruby
14
+ uses: actions/setup-ruby@v1
15
+ with:
16
+ ruby-version: ${{ matrix.ruby }}
17
+ - name: Bundler Install
18
+ run: |
19
+ gem install bundler --no-document
20
+ bundle install --jobs 4 --retry 3
21
+ - name: Run RuboCop
22
+ run: bundle exec rubocop
23
+ Fasterer:
24
+ runs-on: ubuntu-latest
25
+ strategy:
26
+ matrix:
27
+ ruby: [2.5.x, 2.6.x, 2.7.x]
28
+ steps:
29
+ - name: Checkout code
30
+ uses: actions/checkout@v2
31
+ - name: Set up Ruby
32
+ uses: actions/setup-ruby@v1
33
+ with:
34
+ ruby-version: ${{ matrix.ruby }}
35
+ - name: Bundler Install
36
+ run: |
37
+ gem install bundler --no-document
38
+ bundle install --jobs 4 --retry 3
39
+ - name: Run Fasterer
40
+ run: bundle exec fasterer
41
+ Minitest:
42
+ runs-on: ubuntu-latest
43
+ strategy:
44
+ matrix:
45
+ ruby: [2.4.x, 2.5.x, 2.6.x, 2.7.x]
46
+ steps:
47
+ - name: Checkout code
48
+ uses: actions/checkout@v2
49
+ - name: Set up Ruby
50
+ uses: actions/setup-ruby@v1
51
+ with:
52
+ ruby-version: ${{ matrix.ruby }}
53
+ - name: Bundler Install
54
+ run: |
55
+ gem install bundler --no-document
56
+ bundle install --jobs 4 --retry 3
57
+ - name: Run Minitest
58
+ run: ruby -Ilib -e 'ARGV.each { |f| require f }' ./test/test*.rb
59
+ env:
60
+ NCLOUD_ACCESS_KEY: ${{ secrets.NCLOUD_ACCESS_KEY }}
61
+ NCLOUD_SECRET_KEY: ${{ secrets.NCLOUD_SECRET_KEY }}
62
+ NCLOUD_SERVICE_ID: ${{ secrets.NCLOUD_SERVICE_ID }}
63
+ FROM_NUMBER: ${{ secrets.FROM_NUMBER }}
64
+ TO_NUMBER: ${{ secrets.TO_NUMBER }}
@@ -0,0 +1,48 @@
1
+ ### Ruby template
2
+ *.gem
3
+ *.rbc
4
+ /.config
5
+ /coverage/
6
+ /InstalledFiles
7
+ /pkg/
8
+ /spec/reports/
9
+ /spec/examples.txt
10
+ /test/tmp/
11
+ /test/version_tmp/
12
+ /tmp/
13
+
14
+ # Used by dotenv library to load environment variables.
15
+ # .env
16
+
17
+ # Ignore Byebug command history file.
18
+ .byebug_history
19
+
20
+ ## Documentation cache and generated files:
21
+ /.yardoc/
22
+ /_yardoc/
23
+ /doc/
24
+ /rdoc/
25
+
26
+ ## Environment normalization:
27
+ /.bundle/
28
+ /vendor/bundle
29
+ /lib/bundler/man/
30
+
31
+ # for a library or gem, you might want to ignore these files since the code is
32
+ # intended to run in multiple environments; otherwise, check them in:
33
+ Gemfile.lock
34
+ .ruby-version
35
+ .ruby-gemset
36
+ .tool-versions
37
+
38
+ # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
39
+ .rvmrc
40
+
41
+ # Used by RuboCop. Remote config files pulled in from inherit_from directive.
42
+ # .rubocop-https?--*
43
+
44
+ ## Environment Variables
45
+ .env
46
+
47
+ ## Jetbrains IDE
48
+ .idea
@@ -0,0 +1,44 @@
1
+ AllCops:
2
+ TargetRubyVersion: 2.4
3
+ Exclude:
4
+ - Rakefile
5
+ - config.ru
6
+ - db/schema.rb
7
+ - bin/*
8
+ require:
9
+ - rubocop-minitest
10
+ - rubocop-performance
11
+ Metrics/ClassLength:
12
+ Max: 1500
13
+ # Too short methods lead to extraction of single-use methods, which can make
14
+ # the code easier to read (by naming things), but can also clutter the class
15
+ Metrics/MethodLength:
16
+ Max: 20
17
+ Metrics/BlockLength:
18
+ Exclude:
19
+ - test/**/*
20
+ Style/CommentAnnotation:
21
+ Enabled: false
22
+ Style/ClassAndModuleChildren:
23
+ Exclude:
24
+ - test/test_helper.rb
25
+ Style/ClassVars:
26
+ Exclude:
27
+ - lib/sens_sms/client.rb
28
+ # We do not need to support Ruby 1.9, so this is good to use.
29
+ Style/SymbolArray:
30
+ Enabled: true
31
+ Style/AsciiComments:
32
+ Enabled: false
33
+ # Freeze is so earlier thing
34
+ Style/FrozenStringLiteralComment:
35
+ Enabled: false
36
+ Style/Documentation:
37
+ Enabled: false
38
+ Layout/LineLength:
39
+ Max: 120
40
+ # Fix Rainbow Gem
41
+ # https://github.com/rubocop-hq/rubocop/issues/6398#issuecomment-431901995
42
+ inherit_mode:
43
+ merge:
44
+ - Exclude
@@ -0,0 +1,20 @@
1
+ # Changelog
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## [Unreleased]
9
+
10
+ ## [0.1.0] - 2020-02-08
11
+
12
+ ### Added
13
+
14
+ - Fully test code is added.
15
+ - Test and Realease process will be worked on GitHub Action.
16
+ - Send SMS and LMS
17
+ - Validate access keys
18
+
19
+ [unreleased]: https://github.com/olivierlacan/keep-a-changelog/compare/v0.1.0...HEAD
20
+ [0.1.0]: https://github.com/olivierlacan/keep-a-changelog/releases/tag/v0.1.0
@@ -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 say8425@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,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ # Specify your gem's dependencies in sens_sms.gemspec
6
+ gemspec
7
+
8
+ group :development, :test do
9
+ gem 'dotenv'
10
+ gem 'minitest-reporters'
11
+ gem 'rubocop-minitest'
12
+ gem 'rubocop-performance'
13
+ end
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2019 Penguin
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,99 @@
1
+ # Ncloud Sens SMS Gem
2
+
3
+ [![gem version](https://img.shields.io/gem/v/sens_sms?color=cc342d&logo=ruby&logoColor=cc342d)](https://rubygems.org/gems/sens_sms)
4
+ [![GitHub Actions Test](https://github.com/say8425/ncloud_sens_sms/workflows/Test/badge.svg)](https://github.com/say8425/ncloud_sens_sms/actions?query=workflow%3ATest)
5
+ [![GitHub Actions Release](https://github.com/say8425/ncloud_sens_sms/workflows/Release/badge.svg)](https://github.com/say8425/ncloud_sens_sms/actions?query=workflow%3ARelease)
6
+ [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/say8425/ncloud_sens_sms/blob/master/LICENSE)
7
+
8
+
9
+ Send your SMS with Ncloud Sens.
10
+
11
+ ## Installation
12
+
13
+ ### Rails
14
+
15
+ Add this line to your application's Gemfile:
16
+
17
+ ```ruby
18
+ gem 'sens_sms'
19
+ ```
20
+
21
+ Then execute:
22
+
23
+ ```shell script
24
+ $ bundle
25
+ ```
26
+
27
+ Finally, run the generator:
28
+
29
+ ```shell script
30
+ $ rails generate sens_sms:install
31
+ ```
32
+
33
+ At this point, you can find a sens_sms configuration file located at `YOUR_PROJECT/config/initializers/sens_sms.rb`.
34
+ You can set your ncloud access keys here, but we recommend to use Environment Values.
35
+ Generating access keys guide is [here]().
36
+
37
+ ```ruby
38
+ require 'sens_sms'
39
+
40
+ SensSms::Client.configure do |config|
41
+ config.access_key = ENV['NCLOUD_ACCESS_KEY']
42
+ config.secret_key = ENV['NCLOUD_SECRET_KEY']
43
+ config.service_id = ENV['NCLOUD_SERVICE_ID']
44
+ end
45
+ ```
46
+
47
+ ### Sinatra or Plain ol' Ruby
48
+
49
+ Install the gem:
50
+
51
+ ```shell script
52
+ $ gem install sens_sms
53
+ ```
54
+
55
+ ## Usage
56
+
57
+ ### Message Type
58
+
59
+ ```ruby
60
+ # SMS
61
+ SensSms::Client.new
62
+ .deliver(type: :sms,
63
+ from_number: '01012345678',
64
+ to_numbers: '01098765432',
65
+ message: '전 세계에 알려진 펭귄의 종류는 17종 혹은 18종이다.')
66
+ ```
67
+
68
+ ```ruby
69
+ # LMS
70
+ SensSms::Client.new
71
+ .deliver(type: :lms,
72
+ from_number: '01012345678',
73
+ to_numbers: '01098765432',
74
+ title: '펭귄',
75
+ message: '전 세계에 알려진 펭귄의 종류는 17종 혹은 18종이다. (쇠푸른펭귄과 흰날개펭귄이
76
+ 식별되는지 아닌지에 따라 달라진다.) 모든 펭귄 종의 고향이 남반구이기는 하지만,
77
+ 통념과 달리, 남극과 같이 추운 기후에서만 서식하지는 않는다. 실제로는 몇몇 종만이
78
+ 극지방에 산다. 3종은 열대 지방에 살며, 그 가운데 갈라파고스 제도에 사는 한 종은 먹이를
79
+ 찾다가 적도를 건너기도 한다. 가장 큰 종은 황제펭귄으로, 다 자라면 키가 약 1.1미터,
80
+ 무게가 약 35킬로그램 이상이다. 가장 작은 종은 쇠푸른펭귄으로, 키는 약 40센티미터에
81
+ 몸무게가 1킬로그램에 불과하다. 일반적으로 펭귄은 덩치가 클수록 열을 잘 보관해서
82
+ 추운 지방에 살고, 작은 펭귄들은 온대나 심지어 열대에서 발견된다.')
83
+ ```
84
+
85
+ You can use `type` key to choose message type. LMS type can send title and super long text.
86
+ SMS type cannot send title and text length is short. If you try to send title or long text,
87
+ it will be not raised but title will be ignored and text will be sliced at maximum text limit.
88
+
89
+ ### To Numbers
90
+
91
+ foo bar baz
92
+
93
+ ## Contributing
94
+
95
+ Bug reports and pull requests are welcome
96
+
97
+ ## License
98
+
99
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -0,0 +1,10 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << "test"
6
+ t.libs << "lib"
7
+ t.test_files = FileList["test/**/*_test.rb"]
8
+ end
9
+
10
+ task :default => :test
@@ -0,0 +1,14 @@
1
+ #!/usr/bin/env ruby
2
+
3
+ require "bundler/setup"
4
+ require "sens_sms"
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(__FILE__)
@@ -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,6 @@
1
+ Description:
2
+ Sets up Ncloud Sens SMS in your project.
3
+ Examples:
4
+ `rails generate sens_sms:install`
5
+
6
+ `rails generate sens_sms:install --help`
@@ -0,0 +1,8 @@
1
+ module SensSms
2
+ class InstallGenerator < Rails::Generators::Base
3
+ source_root File.expand_path('templates', __dir__)
4
+ def create_initializer
5
+ template 'initializer.rb', 'config/initializers/sens_sms.rb'
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,7 @@
1
+ require 'sens_sms'
2
+
3
+ SensSms::Client.configure do |config|
4
+ config.access_key = ENV['NCLOUD_ACCESS_KEY']
5
+ config.secret_key = ENV['NCLOUD_SECRET_KEY']
6
+ config.service_id = ENV['NCLOUD_SERVICE_ID']
7
+ end
@@ -0,0 +1,9 @@
1
+ require 'http'
2
+ require 'sens_sms/version'
3
+ require 'sens_sms/configure'
4
+ require 'sens_sms/configuration'
5
+ require 'sens_sms/configuration/validate'
6
+ require 'sens_sms/client'
7
+
8
+ module SensSms
9
+ end
@@ -0,0 +1,82 @@
1
+ module SensSms
2
+ class Client
3
+ attr_reader :response, :status, :errors, :request_time, :timestamp
4
+
5
+ def initialize
6
+ raise 'Configure is not valid.' unless validate_configure
7
+ end
8
+
9
+ def deliver(type:, from_number:, to_numbers:, subject: nil, message:)
10
+ raise "Invalid message type: #{type}" unless %i[sms lms].include? type.to_sym
11
+
12
+ @timestamp = current_timestamp
13
+ @response = HTTP.headers(ncloud_sens_api_header)
14
+ .post(ncloud_sens_api_url,
15
+ json: { type: type.to_sym,
16
+ contentType: :COMM,
17
+ countryCode: '82',
18
+ from: from_number,
19
+ subject: subject,
20
+ content: message,
21
+ messages: parsed_messages(to_numbers) })
22
+ @status = response.status
23
+ parse_response
24
+ end
25
+
26
+ def self.configure
27
+ yield configuration
28
+ @@access_key = @configuration.access_key
29
+ @@service_id = @configuration.service_id
30
+ @@secret_key = @configuration.secret_key
31
+ end
32
+
33
+ def self.configuration
34
+ @configuration ||= SensSms::Configure.new
35
+ end
36
+
37
+ private
38
+
39
+ include Configuration
40
+ include Configuration::Validate
41
+
42
+ def parse_response
43
+ if status.success?
44
+ @request_time = Time.parse(response.parse['requestTime'])
45
+ else
46
+ parse_errors
47
+ end
48
+ status.success?
49
+ end
50
+
51
+ def parse_errors
52
+ @errors = response.parse['errors'] if response.parse.key? 'errors'
53
+ @errors = [response.parse['error']['message']] if response.parse.key? 'error'
54
+ end
55
+
56
+ def current_timestamp
57
+ (Time.now.to_f.round(3) * 1000).to_i
58
+ end
59
+
60
+ def ncloud_sens_api_url
61
+ @ncloud_sens_api_url ||= "https://sens.apigw.ntruss.com/sms/v2/services/#{service_id}/messages"
62
+ end
63
+
64
+ def ncloud_sens_api_header
65
+ { 'Content-Type': 'application/json; charset=utf-8',
66
+ 'x-ncp-apigw-timestamp': @timestamp,
67
+ 'x-ncp-apigw-signature-v2': signature,
68
+ 'x-ncp-iam-access-key': access_key }
69
+ end
70
+
71
+ def signature
72
+ sms_uri = "/sms/v2/services/#{service_id}/messages".freeze
73
+ data = "POST #{sms_uri}\n#{@timestamp}\n#{access_key}".freeze
74
+
75
+ Base64.encode64(OpenSSL::HMAC.digest(OpenSSL::Digest.new('sha256'), secret_key, data)).strip
76
+ end
77
+
78
+ def parsed_messages(to_numbers)
79
+ Array(to_numbers).map { |to_number| { to: to_number } }
80
+ end
81
+ end
82
+ end
@@ -0,0 +1,15 @@
1
+ module SensSms
2
+ module Configuration
3
+ def access_key
4
+ self.class.class_variable_get(:@@access_key)
5
+ end
6
+
7
+ def secret_key
8
+ self.class.class_variable_get(:@@secret_key)
9
+ end
10
+
11
+ def service_id
12
+ self.class.class_variable_get(:@@service_id)
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,21 @@
1
+ module SensSms
2
+ module Configuration
3
+ module Validate
4
+ def validate_configure
5
+ validate_configure_defined? && validate_configure_exist?
6
+ end
7
+
8
+ def validate_configure_defined?
9
+ self.class.class_variable_defined?(:@@access_key) &&
10
+ self.class.class_variable_defined?(:@@service_id) &&
11
+ self.class.class_variable_defined?(:@@secret_key)
12
+ end
13
+
14
+ def validate_configure_exist?
15
+ !self.class.class_variable_get(:@@access_key).nil? &&
16
+ !self.class.class_variable_get(:@@service_id).nil? &&
17
+ !self.class.class_variable_get(:@@secret_key).nil?
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,5 @@
1
+ module SensSms
2
+ class Configure
3
+ attr_accessor :access_key, :secret_key, :service_id
4
+ end
5
+ end
@@ -0,0 +1,5 @@
1
+ # frozen_string_literal: true
2
+
3
+ module SensSms
4
+ VERSION = '0.1.0'
5
+ end
@@ -0,0 +1,36 @@
1
+ lib = File.expand_path('lib', __dir__)
2
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ require 'sens_sms/version'
4
+
5
+ Gem::Specification.new do |spec|
6
+ spec.name = 'sens_sms'
7
+ spec.version = SensSms::VERSION
8
+ spec.authors = 'Penguin'
9
+ spec.email = 'say8425@gmail.com'
10
+ spec.summary = 'Sens SMS by Ncloud Sens'
11
+ spec.description = 'The gem is a wrapper for Ncloud Sens SMS.'
12
+ spec.homepage = 'https://github.com/say8425/sens_sms'
13
+ spec.license = 'MIT'
14
+ spec.required_ruby_version = '>= 2.4'
15
+
16
+ spec.metadata['homepage_uri'] = spec.homepage
17
+ spec.metadata['source_code_uri'] = 'https://github.com/say8425/sens_sms'
18
+ spec.metadata['changelog_uri'] = 'https://github.com/say8425/sens_sms/blob/master/CHANGELOG.md'
19
+
20
+ # Specify which files should be added to the gem when it is released.
21
+ # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
22
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
23
+ `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
24
+ end
25
+ spec.bindir = 'exe'
26
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
27
+ spec.require_paths = ['lib']
28
+
29
+ spec.add_dependency 'http', '~> 4.2'
30
+ spec.add_dependency 'railties', '>= 5'
31
+ spec.add_development_dependency 'bundler', '~> 2.0'
32
+ spec.add_development_dependency 'fasterer', '~> 0.8.1'
33
+ spec.add_development_dependency 'minitest', '~> 5.0'
34
+ spec.add_development_dependency 'rake', '~> 13.0'
35
+ spec.add_development_dependency 'rubocop', '~> 0.76'
36
+ end
metadata ADDED
@@ -0,0 +1,166 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: sens_sms
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Penguin
8
+ autorequire:
9
+ bindir: exe
10
+ cert_chain: []
11
+ date: 2020-02-07 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: http
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '4.2'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '4.2'
27
+ - !ruby/object:Gem::Dependency
28
+ name: railties
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '5'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '5'
41
+ - !ruby/object:Gem::Dependency
42
+ name: bundler
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '2.0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '2.0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: fasterer
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: 0.8.1
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: 0.8.1
69
+ - !ruby/object:Gem::Dependency
70
+ name: minitest
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '5.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '5.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: rake
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '13.0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '13.0'
97
+ - !ruby/object:Gem::Dependency
98
+ name: rubocop
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '0.76'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '0.76'
111
+ description: The gem is a wrapper for Ncloud Sens SMS.
112
+ email: say8425@gmail.com
113
+ executables: []
114
+ extensions: []
115
+ extra_rdoc_files: []
116
+ files:
117
+ - ".github/workflows/release.yml"
118
+ - ".github/workflows/test.yml"
119
+ - ".gitignore"
120
+ - ".rubocop.yml"
121
+ - CHANGELOG.md
122
+ - CODE_OF_CONDUCT.md
123
+ - Gemfile
124
+ - LICENSE.txt
125
+ - README.md
126
+ - Rakefile
127
+ - bin/console
128
+ - bin/setup
129
+ - lib/generators/sens_sms/install/README
130
+ - lib/generators/sens_sms/install/install_generator.rb
131
+ - lib/generators/sens_sms/install/templates/initializer.rb
132
+ - lib/sens_sms.rb
133
+ - lib/sens_sms/client.rb
134
+ - lib/sens_sms/configuration.rb
135
+ - lib/sens_sms/configuration/validate.rb
136
+ - lib/sens_sms/configure.rb
137
+ - lib/sens_sms/version.rb
138
+ - sens_sms.gemspec
139
+ homepage: https://github.com/say8425/sens_sms
140
+ licenses:
141
+ - MIT
142
+ metadata:
143
+ homepage_uri: https://github.com/say8425/sens_sms
144
+ source_code_uri: https://github.com/say8425/sens_sms
145
+ changelog_uri: https://github.com/say8425/sens_sms/blob/master/CHANGELOG.md
146
+ post_install_message:
147
+ rdoc_options: []
148
+ require_paths:
149
+ - lib
150
+ required_ruby_version: !ruby/object:Gem::Requirement
151
+ requirements:
152
+ - - ">="
153
+ - !ruby/object:Gem::Version
154
+ version: '2.4'
155
+ required_rubygems_version: !ruby/object:Gem::Requirement
156
+ requirements:
157
+ - - ">="
158
+ - !ruby/object:Gem::Version
159
+ version: '0'
160
+ requirements: []
161
+ rubyforge_project:
162
+ rubygems_version: 2.6.14.4
163
+ signing_key:
164
+ specification_version: 4
165
+ summary: Sens SMS by Ncloud Sens
166
+ test_files: []