Module: NotificationService::Sms::Alibaba::APIConfig
- Included in:
- Authentication, Service
- Defined in:
- app/services/notification_service/sms/alibaba/api_config.rb
Instance Method Summary collapse
- #access_key_secret ⇒ Object
- #default_params ⇒ Object
- #endpoint ⇒ Object
- #http_method ⇒ Object
- #separator ⇒ Object
-
#sort_params(params, sort = 'asc') ⇒ Hash
Sorts the given parameters in ascending or descending order based on the specified sort order (default asc).
Instance Method Details
#access_key_secret ⇒ Object
25 26 27 |
# File 'app/services/notification_service/sms/alibaba/api_config.rb', line 25 def access_key_secret Figaro.env.ALIBABA_ACCESS_KEY_SECRET! end |
#default_params ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'app/services/notification_service/sms/alibaba/api_config.rb', line 7 def default_params { AccessKeyId: Figaro.env.ALIBABA_ACCESS_KEY_ID!, Format: 'JSON', SignatureMethod: 'HMAC-SHA1', SignatureVersion: '1.0', Version: AdminSetting.alibaba_sms_api_version, } end |
#endpoint ⇒ Object
3 4 5 |
# File 'app/services/notification_service/sms/alibaba/api_config.rb', line 3 def endpoint AdminSetting.alibaba_sms_api_host end |
#http_method ⇒ Object
21 22 23 |
# File 'app/services/notification_service/sms/alibaba/api_config.rb', line 21 def http_method 'GET' end |
#separator ⇒ Object
17 18 19 |
# File 'app/services/notification_service/sms/alibaba/api_config.rb', line 17 def separator '&' end |
#sort_params(params, sort = 'asc') ⇒ Hash
Sorts the given parameters in ascending or descending order based on the specified sort order (default asc).
35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'app/services/notification_service/sms/alibaba/api_config.rb', line 35 def sort_params(params, sort = 'asc') unless params.is_a?(Hash) raise ArgumentError, "Params must be a hash, got #{params.class} instead." end case sort.downcase when 'asc' params.sort.to_h when 'desc' params.sort.reverse.to_h else raise ArgumentError, "Invalid sort order: #{sort}. Use 'asc' or 'desc'." end end |