mitake 0.1.2
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 +7 -0
- data/.gitignore +11 -0
- data/.overcommit.yml +34 -0
- data/.rspec +3 -0
- data/.travis.yml +7 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +62 -0
- data/LICENSE +21 -0
- data/README.md +101 -0
- data/Rakefile +8 -0
- data/bin/console +15 -0
- data/bin/setup +8 -0
- data/lib/mitake.rb +48 -0
- data/lib/mitake/api.rb +110 -0
- data/lib/mitake/api/base.rb +69 -0
- data/lib/mitake/api/get.rb +33 -0
- data/lib/mitake/api/post.rb +25 -0
- data/lib/mitake/balance.rb +35 -0
- data/lib/mitake/boolean.rb +24 -0
- data/lib/mitake/credential.rb +29 -0
- data/lib/mitake/message.rb +119 -0
- data/lib/mitake/model.rb +38 -0
- data/lib/mitake/model/accessor.rb +72 -0
- data/lib/mitake/model/attributes.rb +30 -0
- data/lib/mitake/parser.rb +60 -0
- data/lib/mitake/recipient.rb +16 -0
- data/lib/mitake/response.rb +21 -0
- data/lib/mitake/status.rb +21 -0
- data/lib/mitake/status_code.rb +9 -0
- data/lib/mitake/version.rb +5 -0
- data/mitake.gemspec +41 -0
- metadata +159 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 588de0a453cae48483cf27f37c74b2db75e5c5682ed08ac10a3057cd4e478a75
|
4
|
+
data.tar.gz: c338e59a0bcd8df934aae0f52be63c96a7a27bab641efddab5b4758250e1fac8
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 8b6fa1a4e0e4eee00e87a0f8635ccc57d43a3e8cf09fa43775e1c0313ff0f9043efaa269dcb82cc7c2bb9d64959efc45cde7fd66fac5be63893da9bb16c24947
|
7
|
+
data.tar.gz: c64cc7fe68bd9f0b4734bb865927b9d1ecfae1d9ad34018a6d6d66f372b274eb12f5914014029b1f2ae5d82211869d66dc2be95553cb4ba871cee5ba9332faa1
|
data/.gitignore
ADDED
data/.overcommit.yml
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
# Use this file to configure the Overcommit hooks you wish to use. This will
|
2
|
+
# extend the default configuration defined in:
|
3
|
+
# https://github.com/sds/overcommit/blob/master/config/default.yml
|
4
|
+
#
|
5
|
+
# At the topmost level of this YAML file is a key representing type of hook
|
6
|
+
# being run (e.g. pre-commit, commit-msg, etc.). Within each type you can
|
7
|
+
# customize each hook, such as whether to only run it on certain files (via
|
8
|
+
# `include`), whether to only display output if it fails (via `quiet`), etc.
|
9
|
+
#
|
10
|
+
# For a complete list of hooks, see:
|
11
|
+
# https://github.com/sds/overcommit/tree/master/lib/overcommit/hook
|
12
|
+
#
|
13
|
+
# For a complete list of options that you can use to customize hooks, see:
|
14
|
+
# https://github.com/sds/overcommit#configuration
|
15
|
+
#
|
16
|
+
# Uncomment the following lines to make the configuration take effect.
|
17
|
+
|
18
|
+
PreCommit:
|
19
|
+
AuthorName:
|
20
|
+
enabled: false
|
21
|
+
|
22
|
+
RuboCop:
|
23
|
+
enabled: true
|
24
|
+
on_warn: fail # Treat all warnings as failures
|
25
|
+
|
26
|
+
TrailingWhitespace:
|
27
|
+
enabled: true
|
28
|
+
|
29
|
+
PostCheckout:
|
30
|
+
ALL: # Special hook name that customizes all hooks of this type
|
31
|
+
quiet: true # Change all post-checkout hooks to only display output on failure
|
32
|
+
|
33
|
+
IndexTags:
|
34
|
+
enabled: true # Generate a tags file with `ctags` each time HEAD changes
|
data/.rspec
ADDED
data/.travis.yml
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -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 elct9620@frost.tw. 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
data/Gemfile.lock
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
mitake (0.1.2)
|
5
|
+
|
6
|
+
GEM
|
7
|
+
remote: https://rubygems.org/
|
8
|
+
specs:
|
9
|
+
ast (2.4.0)
|
10
|
+
bundler-audit (0.6.1)
|
11
|
+
bundler (>= 1.2.0, < 3)
|
12
|
+
thor (~> 0.18)
|
13
|
+
childprocess (3.0.0)
|
14
|
+
diff-lcs (1.3)
|
15
|
+
iniparse (1.4.4)
|
16
|
+
jaro_winkler (1.5.4)
|
17
|
+
overcommit (0.51.0)
|
18
|
+
childprocess (>= 0.6.3, < 4)
|
19
|
+
iniparse (~> 1.4)
|
20
|
+
parallel (1.19.1)
|
21
|
+
parser (2.6.5.0)
|
22
|
+
ast (~> 2.4.0)
|
23
|
+
rainbow (3.0.0)
|
24
|
+
rake (10.5.0)
|
25
|
+
rspec (3.9.0)
|
26
|
+
rspec-core (~> 3.9.0)
|
27
|
+
rspec-expectations (~> 3.9.0)
|
28
|
+
rspec-mocks (~> 3.9.0)
|
29
|
+
rspec-core (3.9.0)
|
30
|
+
rspec-support (~> 3.9.0)
|
31
|
+
rspec-expectations (3.9.0)
|
32
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
33
|
+
rspec-support (~> 3.9.0)
|
34
|
+
rspec-mocks (3.9.0)
|
35
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
36
|
+
rspec-support (~> 3.9.0)
|
37
|
+
rspec-support (3.9.0)
|
38
|
+
rubocop (0.76.0)
|
39
|
+
jaro_winkler (~> 1.5.1)
|
40
|
+
parallel (~> 1.10)
|
41
|
+
parser (>= 2.6)
|
42
|
+
rainbow (>= 2.2.2, < 4.0)
|
43
|
+
ruby-progressbar (~> 1.7)
|
44
|
+
unicode-display_width (>= 1.4.0, < 1.7)
|
45
|
+
ruby-progressbar (1.10.1)
|
46
|
+
thor (0.20.3)
|
47
|
+
unicode-display_width (1.6.0)
|
48
|
+
|
49
|
+
PLATFORMS
|
50
|
+
ruby
|
51
|
+
|
52
|
+
DEPENDENCIES
|
53
|
+
bundler (~> 2.0)
|
54
|
+
bundler-audit (~> 0.6.1)
|
55
|
+
mitake!
|
56
|
+
overcommit (~> 0.51.0)
|
57
|
+
rake (~> 10.0)
|
58
|
+
rspec (~> 3.0)
|
59
|
+
rubocop (~> 0.76.0)
|
60
|
+
|
61
|
+
BUNDLED WITH
|
62
|
+
2.0.2
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2019 Zheng Xian Qiu
|
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 all
|
13
|
+
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 THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,101 @@
|
|
1
|
+
# Mitake (三竹簡訊)
|
2
|
+
[](https://travis-ci.com/elct9620/mitake) [](https://badge.fury.io/rb/mitake) [](https://codeclimate.com/github/elct9620/mitake/maintainability) [](https://codeclimate.com/github/elct9620/mitake/test_coverage)
|
3
|
+
|
4
|
+
This is a Ruby implement to help user send SMS via 三竹簡訊 easier.
|
5
|
+
|
6
|
+
## Installation
|
7
|
+
|
8
|
+
Add this line to your application's Gemfile:
|
9
|
+
|
10
|
+
```ruby
|
11
|
+
gem 'mitake'
|
12
|
+
```
|
13
|
+
|
14
|
+
And then execute:
|
15
|
+
|
16
|
+
$ bundle
|
17
|
+
|
18
|
+
Or install it yourself as:
|
19
|
+
|
20
|
+
$ gem install mitake
|
21
|
+
|
22
|
+
## Usage
|
23
|
+
|
24
|
+
To send the SMS, you need to specify the username and password.
|
25
|
+
|
26
|
+
```ruby
|
27
|
+
Mitake.credential = Mitake::Credential.new('YOUR_USERNAME', 'YOUR_PASSWORD')
|
28
|
+
```
|
29
|
+
|
30
|
+
If you prefer to config it by the environment variable, please setup `MITAKE_USERNAME` and `MITAKE_PASSWORD`, the gem will automatic create credential.
|
31
|
+
|
32
|
+
> The default server is `https://smsapi.mitake.com.tw` if you use a different server, please specify it manual.
|
33
|
+
|
34
|
+
```ruby
|
35
|
+
# Get the balance in the account
|
36
|
+
puts "Point: #{Mitake::Balance.amount}"
|
37
|
+
|
38
|
+
# Create recipient and give phone number
|
39
|
+
recipient = Mitake::Recipient.new(phone_number: '09xxxxxxxx', name: 'John')
|
40
|
+
|
41
|
+
# Create message with body
|
42
|
+
message = Mitake::Message.new(recipient: recipient, body: 'Hello World!')
|
43
|
+
|
44
|
+
# Delivery message
|
45
|
+
message.delivery
|
46
|
+
|
47
|
+
# Check status
|
48
|
+
puts message.status unless message.sent?
|
49
|
+
```
|
50
|
+
|
51
|
+
### Switch Credential
|
52
|
+
|
53
|
+
If you have multiple credentials, you can switch it in the runtime.
|
54
|
+
|
55
|
+
```ruby
|
56
|
+
external = Mitake::Credential.new('xxx', 'xxx')
|
57
|
+
|
58
|
+
Mitake.use(external) do
|
59
|
+
# Replace default credential with external
|
60
|
+
end
|
61
|
+
|
62
|
+
# Switch back to use default credential
|
63
|
+
```
|
64
|
+
|
65
|
+
### Message Attributes
|
66
|
+
|
67
|
+
|Name|Type|Description
|
68
|
+
|----|----|-----------
|
69
|
+
|id|String| `Readonly` The message ID from Mitake
|
70
|
+
|source_id|String| The customize identity, if same `source_id` send to Mitake, it will response duplicate flag
|
71
|
+
|recipient|Mitake::Recipient| The recipient of message
|
72
|
+
|body|String| The message body
|
73
|
+
|schedule_at|Time| The schedule time to send message
|
74
|
+
|expired_at|Time| The message expire time, max value is `+ 24h`
|
75
|
+
|webhook_url|String| The Callback URL for Mitake response status
|
76
|
+
|duplicate|TrueClass/FalseClass| `Readonly` The message is duplicate (already sent)
|
77
|
+
|status_code|Integer| `Readonly` The message status
|
78
|
+
|
79
|
+
## Roadmap
|
80
|
+
|
81
|
+
* [ ] Rspec tests
|
82
|
+
* [ ] Message
|
83
|
+
* [x] Delivery
|
84
|
+
* [ ] Batch Delivery
|
85
|
+
* [ ] Webhook
|
86
|
+
* [ ] Query Status
|
87
|
+
* [ ] Cancel
|
88
|
+
|
89
|
+
## Development
|
90
|
+
|
91
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
92
|
+
|
93
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
94
|
+
|
95
|
+
## Contributing
|
96
|
+
|
97
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/elct9620/mitake. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
98
|
+
|
99
|
+
## Code of Conduct
|
100
|
+
|
101
|
+
Everyone interacting in the Mitake project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/elct9620/mitake/blob/master/CODE_OF_CONDUCT.md).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
require 'bundler/setup'
|
5
|
+
require 'mitake'
|
6
|
+
|
7
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
8
|
+
# with your gem easier. You can also use a different console, if you like.
|
9
|
+
|
10
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
11
|
+
# require "pry"
|
12
|
+
# Pry.start
|
13
|
+
|
14
|
+
require 'irb'
|
15
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
data/lib/mitake.rb
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'mitake/version'
|
4
|
+
require 'mitake/credential'
|
5
|
+
require 'mitake/balance'
|
6
|
+
require 'mitake/message'
|
7
|
+
|
8
|
+
# The Mitake API Client
|
9
|
+
#
|
10
|
+
# @since 0.1.0
|
11
|
+
module Mitake
|
12
|
+
# @since 0.1.0
|
13
|
+
# @api private
|
14
|
+
LOCK = Mutex.new
|
15
|
+
|
16
|
+
# Switch credential
|
17
|
+
#
|
18
|
+
# @param credential [Mitake::Credential] the api credential
|
19
|
+
# @param _block [Proc] the actions use specify credential
|
20
|
+
#
|
21
|
+
# @since 0.1.0
|
22
|
+
def self.use(credential, &_block)
|
23
|
+
temp = credential
|
24
|
+
LOCK.synchronize do
|
25
|
+
self.credential = credential
|
26
|
+
yield
|
27
|
+
self.credential = temp
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
# The credential
|
32
|
+
#
|
33
|
+
# @return [Mitake::Credential] the current credential
|
34
|
+
#
|
35
|
+
# @since 0.1.0
|
36
|
+
def self.credential
|
37
|
+
@credential ||= Credential.new
|
38
|
+
end
|
39
|
+
|
40
|
+
# Set credential
|
41
|
+
#
|
42
|
+
# @param credential [Mitake::Credential] the new credential
|
43
|
+
#
|
44
|
+
# @since 0.1.0
|
45
|
+
def self.credential=(credential)
|
46
|
+
@credential = credential
|
47
|
+
end
|
48
|
+
end
|
data/lib/mitake/api.rb
ADDED
@@ -0,0 +1,110 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'mitake/parser'
|
4
|
+
require 'mitake/api/get'
|
5
|
+
require 'mitake/api/post'
|
6
|
+
|
7
|
+
module Mitake
|
8
|
+
# Provide API Interface
|
9
|
+
#
|
10
|
+
# @since 0.1.0
|
11
|
+
# @api private
|
12
|
+
module API
|
13
|
+
class Error < RuntimeError; end
|
14
|
+
|
15
|
+
# @since 0.1.0
|
16
|
+
# @api private
|
17
|
+
def self.included(base)
|
18
|
+
base.class_eval do
|
19
|
+
@method = 'Get'
|
20
|
+
|
21
|
+
extend ClassMethods
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
# @since 0.1.0
|
26
|
+
# @api private
|
27
|
+
module ClassMethods
|
28
|
+
# Set/Get the api path
|
29
|
+
#
|
30
|
+
# @param path [String] the api endpoint path
|
31
|
+
# @return [String] if path not given, return previous value
|
32
|
+
#
|
33
|
+
# @since 0.1.0
|
34
|
+
# @api private
|
35
|
+
def path(path = nil)
|
36
|
+
return @path if path.nil?
|
37
|
+
|
38
|
+
@path = path
|
39
|
+
end
|
40
|
+
|
41
|
+
# Set/Get the api method
|
42
|
+
#
|
43
|
+
# @param method [String] the api request method
|
44
|
+
# @return [String] if method not given, return previous value
|
45
|
+
#
|
46
|
+
# @since 0.1.0
|
47
|
+
# @api private
|
48
|
+
def method(method = nil)
|
49
|
+
return @method if method.nil?
|
50
|
+
|
51
|
+
@method = method.to_s.capitalize
|
52
|
+
end
|
53
|
+
|
54
|
+
# Set response field mapping
|
55
|
+
#
|
56
|
+
# @param from [String] the response field
|
57
|
+
# @param to [String] the target field
|
58
|
+
#
|
59
|
+
# @since 0.1.0
|
60
|
+
# @api private
|
61
|
+
def map(from, to)
|
62
|
+
@mapping ||= {}
|
63
|
+
@mapping[from.to_s] = to.to_s
|
64
|
+
end
|
65
|
+
|
66
|
+
# Execute API
|
67
|
+
#
|
68
|
+
# @param params [Hash] the API params
|
69
|
+
# @param _block [Proc] the customize process
|
70
|
+
# @return [Mitake::API] the api response
|
71
|
+
#
|
72
|
+
# @since 0.1.0
|
73
|
+
# @api private
|
74
|
+
def execute(params = {}, &_block)
|
75
|
+
res = request(params)
|
76
|
+
raise Mitake::API::Error, res.code unless res.is_a?(Net::HTTPOK)
|
77
|
+
|
78
|
+
items = Parser.new(res).parse.map { |item| rename_attribute(item) }
|
79
|
+
return items.map { |item| new(item) } unless block_given?
|
80
|
+
|
81
|
+
yield items
|
82
|
+
end
|
83
|
+
|
84
|
+
private
|
85
|
+
|
86
|
+
# Send HTTP Request
|
87
|
+
#
|
88
|
+
# @return [Net::HTTPResponse] the http response
|
89
|
+
#
|
90
|
+
# @since 0.1.0
|
91
|
+
# @api private
|
92
|
+
def request(params = {})
|
93
|
+
klass = API.const_get(method)
|
94
|
+
klass.new(path, params).execute
|
95
|
+
end
|
96
|
+
|
97
|
+
# Rename attributes
|
98
|
+
#
|
99
|
+
# @param item [Hash] the source hash
|
100
|
+
#
|
101
|
+
# @since 0.1.0
|
102
|
+
# @api private
|
103
|
+
def rename_attribute(item)
|
104
|
+
item.map do |key, value|
|
105
|
+
[@mapping[key] || key, value]
|
106
|
+
end.to_h
|
107
|
+
end
|
108
|
+
end
|
109
|
+
end
|
110
|
+
end
|