moceansdk 1.1.0 → 1.1.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.
- checksums.yaml +4 -4
- data/README.md +2 -1
- data/lib/moceansdk.rb +13 -0
- data/lib/moceansdk/client.rb +4 -0
- data/lib/moceansdk/modules/command/command.rb +47 -0
- data/lib/moceansdk/modules/command/mc.rb +40 -0
- data/lib/moceansdk/modules/command/mc_builder.rb +30 -0
- data/lib/moceansdk/modules/command/mc_object/abstract_mc.rb +36 -0
- data/lib/moceansdk/modules/command/mc_object/send_sms.rb +41 -0
- data/lib/moceansdk/modules/command/mc_object/tg_request_contact.rb +49 -0
- data/lib/moceansdk/modules/command/mc_object/tg_send_animation.rb +41 -0
- data/lib/moceansdk/modules/command/mc_object/tg_send_audio.rb +41 -0
- data/lib/moceansdk/modules/command/mc_object/tg_send_document.rb +41 -0
- data/lib/moceansdk/modules/command/mc_object/tg_send_photo.rb +41 -0
- data/lib/moceansdk/modules/command/mc_object/tg_send_text.rb +41 -0
- data/lib/moceansdk/modules/command/mc_object/tg_send_video.rb +41 -0
- data/lib/moceansdk/modules/message/channel.rb +1 -0
- data/lib/moceansdk/modules/message/verify_request.rb +2 -0
- data/lib/moceansdk/version.rb +1 -1
- data/moceansdk.gemspec +1 -1
- metadata +16 -5
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: b0b4c0c5f19f708f2e1d0f255eed1341244f64922b75cde574d9765cadc570f6
         | 
| 4 | 
            +
              data.tar.gz: 628465a50f969494c965a77b5f0868c89ac11d0b1f0be7f2b0d17c0ac786cc8c
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: a1a3f349fdf7127a1157272a7cb56cac46a03d139ff8a03f756218f5697f936ac35bb4a20ec2056de93dda42100649e88ed789d2c55f9aed375f0828d9ff0f52
         | 
| 7 | 
            +
              data.tar.gz: 38ba32440b25ad20da427f5e5242eaf0ab03ba22b273344a140d02e887424fbb216b6a5faacdb82cf4a5b0d44926f24c49f182446b1e1a366cfe827a2c1fbff8
         | 
    
        data/README.md
    CHANGED
    
    | @@ -2,6 +2,7 @@ MoceanAPI Client Library for Ruby | |
| 2 2 | 
             
            ============================
         | 
| 3 3 | 
             
            [](https://rubygems.org/gems/moceansdk) 
         | 
| 4 4 | 
             
            [](https://travis-ci.com/MoceanAPI/mocean-sdk-ruby)
         | 
| 5 | 
            +
            [](https://github.com/MoceanAPI/mocean-sdk-ruby/actions/workflows/build.yml)
         | 
| 5 6 | 
             
            [](https://codecov.io/gh/MoceanAPI/mocean-sdk-ruby)
         | 
| 6 7 | 
             
            [](https://app.codacy.com/project/MoceanAPI/mocean-sdk-ruby/dashboard)
         | 
| 7 8 | 
             
            [](http://opensource.org/licenses/MIT)
         | 
| @@ -68,7 +69,7 @@ Kindly visit [MoceanApi Docs][doc_main] for more usage | |
| 68 69 |  | 
| 69 70 | 
             
            This library is released under the [MIT License][license]
         | 
| 70 71 |  | 
| 71 | 
            -
            [signup]: https://dashboard.moceanapi.com/register?medium=github&campaign=sdk | 
| 72 | 
            +
            [signup]: https://dashboard.moceanapi.com/register?medium=github&campaign=ruby-sdk
         | 
| 72 73 | 
             
            [doc_main]: https://moceanapi.com/docs/?ruby
         | 
| 73 74 | 
             
            [doc_sms]: https://moceanapi.com/docs/?ruby#send-sms
         | 
| 74 75 | 
             
            [license]: LICENSE.txt
         | 
    
        data/lib/moceansdk.rb
    CHANGED
    
    | @@ -34,6 +34,19 @@ require 'moceansdk/modules/voice/mc' | |
| 34 34 | 
             
            require 'moceansdk/modules/voice/mc_builder'
         | 
| 35 35 | 
             
            require 'moceansdk/modules/voice/voice'
         | 
| 36 36 |  | 
| 37 | 
            +
            require 'moceansdk/modules/command/mc_object/abstract_mc'
         | 
| 38 | 
            +
            require 'moceansdk/modules/command/mc_object/tg_send_text'
         | 
| 39 | 
            +
            require 'moceansdk/modules/command/mc_object/tg_send_audio'
         | 
| 40 | 
            +
            require 'moceansdk/modules/command/mc_object/tg_send_animation'
         | 
| 41 | 
            +
            require 'moceansdk/modules/command/mc_object/tg_send_photo'
         | 
| 42 | 
            +
            require 'moceansdk/modules/command/mc_object/tg_send_video'
         | 
| 43 | 
            +
            require 'moceansdk/modules/command/mc_object/tg_send_document'
         | 
| 44 | 
            +
            require 'moceansdk/modules/command/mc_object/tg_request_contact'
         | 
| 45 | 
            +
            require 'moceansdk/modules/command/mc_object/send_sms'
         | 
| 46 | 
            +
            require 'moceansdk/modules/command/mc'
         | 
| 47 | 
            +
            require 'moceansdk/modules/command/mc_builder'
         | 
| 48 | 
            +
            require 'moceansdk/modules/command/command'
         | 
| 49 | 
            +
             | 
| 37 50 | 
             
            require 'moceansdk/utils'
         | 
| 38 51 | 
             
            require 'moceansdk/version'
         | 
| 39 52 | 
             
            require 'moceansdk/client'
         | 
    
        data/lib/moceansdk/client.rb
    CHANGED
    
    
| @@ -0,0 +1,47 @@ | |
| 1 | 
            +
            module Moceansdk
         | 
| 2 | 
            +
              module Modules
         | 
| 3 | 
            +
                module Command
         | 
| 4 | 
            +
             | 
| 5 | 
            +
                  class Command < Moceansdk::Modules::AbstractClient
         | 
| 6 | 
            +
                    def initialize(obj_auth, transmitter)
         | 
| 7 | 
            +
                      super(obj_auth, transmitter)
         | 
| 8 | 
            +
                      @required_fields = ['mocean-api-key', 'mocean-api-secret','mocean-command']
         | 
| 9 | 
            +
                    end
         | 
| 10 | 
            +
             | 
| 11 | 
            +
                    def event_url=(param)
         | 
| 12 | 
            +
                      @params['mocean-event-url'] = param
         | 
| 13 | 
            +
                    end
         | 
| 14 | 
            +
             | 
| 15 | 
            +
                    def mocean_command=(param)
         | 
| 16 | 
            +
                      if param.is_a? McBuilder
         | 
| 17 | 
            +
                        @params['mocean-command'] = JSON.generate(param.build)
         | 
| 18 | 
            +
                      elsif param.is_a? McObject::AbstractMc
         | 
| 19 | 
            +
                        @params['mocean-command'] = JSON.generate([param.get_request_data])
         | 
| 20 | 
            +
                      elsif param.is_a? Array
         | 
| 21 | 
            +
                        @params['mocean-command'] = JSON.generate(param)
         | 
| 22 | 
            +
                      else
         | 
| 23 | 
            +
                        @params['mocean-command'] = param
         | 
| 24 | 
            +
                      end
         | 
| 25 | 
            +
                    end
         | 
| 26 | 
            +
             | 
| 27 | 
            +
             | 
| 28 | 
            +
                    def execute(params = {})
         | 
| 29 | 
            +
                      sym_params = Moceansdk::Utils.convert_to_symbol_hash(params)
         | 
| 30 | 
            +
             | 
| 31 | 
            +
                      unless sym_params[:'mocean-command'].nil?
         | 
| 32 | 
            +
                        mc = sym_params[:'mocean-command']
         | 
| 33 | 
            +
                        sym_params.delete(:'mocean-command')
         | 
| 34 | 
            +
                        self.mocean_command = mc
         | 
| 35 | 
            +
                      end
         | 
| 36 | 
            +
             | 
| 37 | 
            +
                      create(sym_params)
         | 
| 38 | 
            +
                      create_final_params
         | 
| 39 | 
            +
                      required_field_set?
         | 
| 40 | 
            +
             | 
| 41 | 
            +
                      # @sym_params[:'mocean-command'] = JSON.generate(@sym_params[:'mocean-command'].build)
         | 
| 42 | 
            +
                      @transmitter.post('/send-message', @params)
         | 
| 43 | 
            +
                    end
         | 
| 44 | 
            +
                  end
         | 
| 45 | 
            +
                end
         | 
| 46 | 
            +
              end
         | 
| 47 | 
            +
            end
         | 
| @@ -0,0 +1,40 @@ | |
| 1 | 
            +
            module Moceansdk
         | 
| 2 | 
            +
              module Modules
         | 
| 3 | 
            +
                module Command
         | 
| 4 | 
            +
             | 
| 5 | 
            +
                  class Mc
         | 
| 6 | 
            +
                    def self.tg_send_text()
         | 
| 7 | 
            +
                      McObject::TgSendText.new
         | 
| 8 | 
            +
                    end
         | 
| 9 | 
            +
             | 
| 10 | 
            +
                    def self.tg_send_audio()
         | 
| 11 | 
            +
                      McObject::TgSendAudio.new
         | 
| 12 | 
            +
                    end
         | 
| 13 | 
            +
             | 
| 14 | 
            +
                    def self.tg_send_animation()
         | 
| 15 | 
            +
                      McObject::TgSendAnimation.new
         | 
| 16 | 
            +
                    end
         | 
| 17 | 
            +
             | 
| 18 | 
            +
                    def self.tg_send_document()
         | 
| 19 | 
            +
                      McObject::TgSendDocument.new
         | 
| 20 | 
            +
                    end
         | 
| 21 | 
            +
             | 
| 22 | 
            +
                    def self.tg_send_photo()
         | 
| 23 | 
            +
                      McObject::TgSendPhoto.new
         | 
| 24 | 
            +
                    end
         | 
| 25 | 
            +
             | 
| 26 | 
            +
                    def self.tg_send_video()
         | 
| 27 | 
            +
                      McObject::TgSendVideo.new
         | 
| 28 | 
            +
                    end
         | 
| 29 | 
            +
             | 
| 30 | 
            +
                    def self.tg_request_contact()
         | 
| 31 | 
            +
                      McObject::TgRequestContact.new
         | 
| 32 | 
            +
                    end
         | 
| 33 | 
            +
             | 
| 34 | 
            +
                    def self.send_sms()
         | 
| 35 | 
            +
                      McObject::SendSMS.new
         | 
| 36 | 
            +
                    end
         | 
| 37 | 
            +
                  end
         | 
| 38 | 
            +
                end
         | 
| 39 | 
            +
              end
         | 
| 40 | 
            +
            end
         | 
| @@ -0,0 +1,30 @@ | |
| 1 | 
            +
            module Moceansdk
         | 
| 2 | 
            +
              module Modules
         | 
| 3 | 
            +
                module Command
         | 
| 4 | 
            +
             | 
| 5 | 
            +
                  class McBuilder
         | 
| 6 | 
            +
                    def initialize
         | 
| 7 | 
            +
                      @mc = []
         | 
| 8 | 
            +
                    end
         | 
| 9 | 
            +
             | 
| 10 | 
            +
                    def add(mc)
         | 
| 11 | 
            +
                      unless mc.is_a? McObject::AbstractMc
         | 
| 12 | 
            +
                        raise Moceansdk::Exceptions::MoceanError, 'mc_object must extend AbstractMc'
         | 
| 13 | 
            +
                      end
         | 
| 14 | 
            +
             | 
| 15 | 
            +
                      @mc.push(mc)
         | 
| 16 | 
            +
                      self
         | 
| 17 | 
            +
                    end
         | 
| 18 | 
            +
             | 
| 19 | 
            +
                    def build
         | 
| 20 | 
            +
                      converted = []
         | 
| 21 | 
            +
                      @mc.each do |mc|
         | 
| 22 | 
            +
                        converted.push(mc.get_request_data)
         | 
| 23 | 
            +
                      end
         | 
| 24 | 
            +
                      converted
         | 
| 25 | 
            +
                    end
         | 
| 26 | 
            +
                  end
         | 
| 27 | 
            +
             | 
| 28 | 
            +
                end
         | 
| 29 | 
            +
              end
         | 
| 30 | 
            +
            end
         | 
| @@ -0,0 +1,36 @@ | |
| 1 | 
            +
            module Moceansdk
         | 
| 2 | 
            +
              module Modules
         | 
| 3 | 
            +
                module Command
         | 
| 4 | 
            +
                  module McObject
         | 
| 5 | 
            +
             | 
| 6 | 
            +
                    class AbstractMc
         | 
| 7 | 
            +
                      def initialize(params = nil)
         | 
| 8 | 
            +
                        @params = {}
         | 
| 9 | 
            +
                        @params = Moceansdk::Utils.convert_to_symbol_hash(params) unless params.nil?
         | 
| 10 | 
            +
                      end
         | 
| 11 | 
            +
             | 
| 12 | 
            +
                      def get_request_data
         | 
| 13 | 
            +
                        @params = Moceansdk::Utils.convert_to_symbol_hash(@params)
         | 
| 14 | 
            +
                        required_key.each do |key|
         | 
| 15 | 
            +
                          if @params[:"#{key}"].nil?
         | 
| 16 | 
            +
                            raise Moceansdk::Exceptions::RequiredFieldException, "#{key} is mandatory field, can't leave empty (#{self})"
         | 
| 17 | 
            +
                          end
         | 
| 18 | 
            +
                        end
         | 
| 19 | 
            +
                        @params[:action] = action
         | 
| 20 | 
            +
                        @params
         | 
| 21 | 
            +
                      end
         | 
| 22 | 
            +
             | 
| 23 | 
            +
                      def required_key
         | 
| 24 | 
            +
                        raise NotImplementedError, 'AbstractMc is a abstract class'
         | 
| 25 | 
            +
                      end
         | 
| 26 | 
            +
             | 
| 27 | 
            +
                      def action
         | 
| 28 | 
            +
                        raise NotImplementedError, 'AbstractMc is a abstract class'
         | 
| 29 | 
            +
                      end
         | 
| 30 | 
            +
             | 
| 31 | 
            +
                    end
         | 
| 32 | 
            +
             | 
| 33 | 
            +
                  end
         | 
| 34 | 
            +
                end
         | 
| 35 | 
            +
              end
         | 
| 36 | 
            +
            end
         | 
| @@ -0,0 +1,41 @@ | |
| 1 | 
            +
            module Moceansdk
         | 
| 2 | 
            +
              module Modules
         | 
| 3 | 
            +
                module Command
         | 
| 4 | 
            +
                  module McObject
         | 
| 5 | 
            +
             | 
| 6 | 
            +
                    class SendSMS < AbstractMc
         | 
| 7 | 
            +
                      def action
         | 
| 8 | 
            +
                        'send-sms'
         | 
| 9 | 
            +
                      end
         | 
| 10 | 
            +
             | 
| 11 | 
            +
                      def required_key
         | 
| 12 | 
            +
                        ['from','to','content']
         | 
| 13 | 
            +
                      end
         | 
| 14 | 
            +
             | 
| 15 | 
            +
                      def from(from, contact_type = 'phone_num')
         | 
| 16 | 
            +
                        @params[:'from'] = {}
         | 
| 17 | 
            +
                        @params[:'from'][:'id'] = from
         | 
| 18 | 
            +
                        @params[:'from'][:'type'] = contact_type
         | 
| 19 | 
            +
                        return self
         | 
| 20 | 
            +
                      end
         | 
| 21 | 
            +
             | 
| 22 | 
            +
                      def to(to, contact_type = "phone_num")
         | 
| 23 | 
            +
                        @params[:'to'] = {}
         | 
| 24 | 
            +
                        @params[:'to'][:'id'] = to
         | 
| 25 | 
            +
                        @params[:'to'][:'type'] = contact_type
         | 
| 26 | 
            +
                        return self
         | 
| 27 | 
            +
                      end
         | 
| 28 | 
            +
             | 
| 29 | 
            +
                      def content(text)
         | 
| 30 | 
            +
                        @params[:'content'] = {}
         | 
| 31 | 
            +
                        @params[:'content'][:'text'] = text
         | 
| 32 | 
            +
                        @params[:'content'][:'type'] = 'text'
         | 
| 33 | 
            +
                        return self
         | 
| 34 | 
            +
                      end
         | 
| 35 | 
            +
             | 
| 36 | 
            +
                    end
         | 
| 37 | 
            +
             | 
| 38 | 
            +
                  end
         | 
| 39 | 
            +
                end
         | 
| 40 | 
            +
              end
         | 
| 41 | 
            +
            end
         | 
| @@ -0,0 +1,49 @@ | |
| 1 | 
            +
            module Moceansdk
         | 
| 2 | 
            +
              module Modules
         | 
| 3 | 
            +
                module Command
         | 
| 4 | 
            +
                  module McObject
         | 
| 5 | 
            +
             | 
| 6 | 
            +
                    class TgRequestContact < AbstractMc
         | 
| 7 | 
            +
                      def action
         | 
| 8 | 
            +
                        'send-telegram'
         | 
| 9 | 
            +
                      end
         | 
| 10 | 
            +
             | 
| 11 | 
            +
                      def required_key
         | 
| 12 | 
            +
                        ['from', 'to', 'content', 'tg_keyboard']
         | 
| 13 | 
            +
                      end
         | 
| 14 | 
            +
             | 
| 15 | 
            +
                      def from(from, contact_type = 'bot_username')
         | 
| 16 | 
            +
                        @params[:'from'] = {}
         | 
| 17 | 
            +
                        @params[:'from'][:'id'] = from
         | 
| 18 | 
            +
                        @params[:'from'][:'type'] = contact_type
         | 
| 19 | 
            +
                        return self
         | 
| 20 | 
            +
                      end
         | 
| 21 | 
            +
             | 
| 22 | 
            +
                      def to(to, contact_type = "chat_id")
         | 
| 23 | 
            +
                        @params[:'to'] = {}
         | 
| 24 | 
            +
                        @params[:'to'][:'id'] = to
         | 
| 25 | 
            +
                        @params[:'to'][:'type'] = contact_type
         | 
| 26 | 
            +
                        return self
         | 
| 27 | 
            +
                      end
         | 
| 28 | 
            +
             | 
| 29 | 
            +
                      def content(text)
         | 
| 30 | 
            +
                        @params[:'content'] = {}
         | 
| 31 | 
            +
                        @params[:'content'][:'text'] = text
         | 
| 32 | 
            +
                        @params[:'content'][:'type'] = 'text'
         | 
| 33 | 
            +
                        return self
         | 
| 34 | 
            +
                      end
         | 
| 35 | 
            +
             | 
| 36 | 
            +
                      def button(text)
         | 
| 37 | 
            +
                        @params[:'tg_keyboard'] = {
         | 
| 38 | 
            +
                          :'button_text' => text,
         | 
| 39 | 
            +
                          :'button_request' => 'contact'
         | 
| 40 | 
            +
                        }
         | 
| 41 | 
            +
                        return self
         | 
| 42 | 
            +
                      end
         | 
| 43 | 
            +
             | 
| 44 | 
            +
                    end
         | 
| 45 | 
            +
             | 
| 46 | 
            +
                  end
         | 
| 47 | 
            +
                end
         | 
| 48 | 
            +
              end
         | 
| 49 | 
            +
            end
         | 
| @@ -0,0 +1,41 @@ | |
| 1 | 
            +
            module Moceansdk
         | 
| 2 | 
            +
              module Modules
         | 
| 3 | 
            +
                module Command
         | 
| 4 | 
            +
                  module McObject
         | 
| 5 | 
            +
             | 
| 6 | 
            +
                    class TgSendAnimation < AbstractMc
         | 
| 7 | 
            +
                        def action
         | 
| 8 | 
            +
                          'send-telegram'
         | 
| 9 | 
            +
                        end
         | 
| 10 | 
            +
             | 
| 11 | 
            +
                        def required_key
         | 
| 12 | 
            +
                          ['from','to','content']
         | 
| 13 | 
            +
                        end
         | 
| 14 | 
            +
             | 
| 15 | 
            +
                        def from(from, contact_type = 'bot_username')
         | 
| 16 | 
            +
                          @params[:'from'] = {}
         | 
| 17 | 
            +
                          @params[:'from'][:'id'] = from
         | 
| 18 | 
            +
                          @params[:'from'][:'type'] = contact_type
         | 
| 19 | 
            +
                          return self
         | 
| 20 | 
            +
                        end
         | 
| 21 | 
            +
             | 
| 22 | 
            +
                        def to(to, contact_type = "chat_id")
         | 
| 23 | 
            +
                          @params[:'to'] = {}
         | 
| 24 | 
            +
                          @params[:'to'][:'id'] = to
         | 
| 25 | 
            +
                          @params[:'to'][:'type'] = contact_type
         | 
| 26 | 
            +
                          return self
         | 
| 27 | 
            +
                        end
         | 
| 28 | 
            +
             | 
| 29 | 
            +
                        def content(url,text)
         | 
| 30 | 
            +
                          @params[:'content'] = {}
         | 
| 31 | 
            +
                          @params[:'content'][:'rich_media_url'] = url
         | 
| 32 | 
            +
                          @params[:'content'][:'text'] = text
         | 
| 33 | 
            +
                          @params[:'content'][:'type'] = 'animation'
         | 
| 34 | 
            +
                          return self
         | 
| 35 | 
            +
                        end
         | 
| 36 | 
            +
                    end
         | 
| 37 | 
            +
             | 
| 38 | 
            +
                  end
         | 
| 39 | 
            +
                end
         | 
| 40 | 
            +
              end
         | 
| 41 | 
            +
            end
         | 
| @@ -0,0 +1,41 @@ | |
| 1 | 
            +
            module Moceansdk
         | 
| 2 | 
            +
              module Modules
         | 
| 3 | 
            +
                module Command
         | 
| 4 | 
            +
                  module McObject
         | 
| 5 | 
            +
             | 
| 6 | 
            +
                    class TgSendAudio < AbstractMc
         | 
| 7 | 
            +
                        def action
         | 
| 8 | 
            +
                          'send-telegram'
         | 
| 9 | 
            +
                        end
         | 
| 10 | 
            +
             | 
| 11 | 
            +
                        def required_key
         | 
| 12 | 
            +
                          ['from','to','content']
         | 
| 13 | 
            +
                        end
         | 
| 14 | 
            +
             | 
| 15 | 
            +
                        def from(from, contact_type = 'bot_username')
         | 
| 16 | 
            +
                          @params[:'from'] = {}
         | 
| 17 | 
            +
                          @params[:'from'][:'id'] = from
         | 
| 18 | 
            +
                          @params[:'from'][:'type'] = contact_type
         | 
| 19 | 
            +
                          return self
         | 
| 20 | 
            +
                        end
         | 
| 21 | 
            +
             | 
| 22 | 
            +
                        def to(to, contact_type = "chat_id")
         | 
| 23 | 
            +
                          @params[:'to'] = {}
         | 
| 24 | 
            +
                          @params[:'to'][:'id'] = to
         | 
| 25 | 
            +
                          @params[:'to'][:'type'] = contact_type
         | 
| 26 | 
            +
                          return self
         | 
| 27 | 
            +
                        end
         | 
| 28 | 
            +
             | 
| 29 | 
            +
                        def content(url, text)
         | 
| 30 | 
            +
                          @params[:'content'] = {}
         | 
| 31 | 
            +
                          @params[:'content'][:'rich_media_url'] = url
         | 
| 32 | 
            +
                          @params[:'content'][:'text'] = text
         | 
| 33 | 
            +
                          @params[:'content'][:'type'] = 'audio'
         | 
| 34 | 
            +
                          return self
         | 
| 35 | 
            +
                        end
         | 
| 36 | 
            +
                    end
         | 
| 37 | 
            +
             | 
| 38 | 
            +
                  end
         | 
| 39 | 
            +
                end
         | 
| 40 | 
            +
              end
         | 
| 41 | 
            +
            end
         | 
| @@ -0,0 +1,41 @@ | |
| 1 | 
            +
            module Moceansdk
         | 
| 2 | 
            +
              module Modules
         | 
| 3 | 
            +
                module Command
         | 
| 4 | 
            +
                  module McObject
         | 
| 5 | 
            +
             | 
| 6 | 
            +
                    class TgSendDocument < AbstractMc
         | 
| 7 | 
            +
                      def action
         | 
| 8 | 
            +
                        'send-telegram'
         | 
| 9 | 
            +
                      end
         | 
| 10 | 
            +
             | 
| 11 | 
            +
                      def required_key
         | 
| 12 | 
            +
                        ['from','to','content']
         | 
| 13 | 
            +
                      end
         | 
| 14 | 
            +
             | 
| 15 | 
            +
                      def from(from, contact_type = 'bot_username')
         | 
| 16 | 
            +
                        @params[:'from'] = {}
         | 
| 17 | 
            +
                        @params[:'from'][:'id'] = from
         | 
| 18 | 
            +
                        @params[:'from'][:'type'] = contact_type
         | 
| 19 | 
            +
                        return self
         | 
| 20 | 
            +
                      end
         | 
| 21 | 
            +
             | 
| 22 | 
            +
                      def to(to, contact_type = "chat_id")
         | 
| 23 | 
            +
                        @params[:'to'] = {}
         | 
| 24 | 
            +
                        @params[:'to'][:'id'] = to
         | 
| 25 | 
            +
                        @params[:'to'][:'type'] = contact_type
         | 
| 26 | 
            +
                        return self
         | 
| 27 | 
            +
                      end
         | 
| 28 | 
            +
             | 
| 29 | 
            +
                      def content(url,text)
         | 
| 30 | 
            +
                        @params[:'content'] = {}
         | 
| 31 | 
            +
                        @params[:'content'][:'rich_media_url'] = url
         | 
| 32 | 
            +
                        @params[:'content'][:'text'] = text
         | 
| 33 | 
            +
                        @params[:'content'][:'type'] = 'document'
         | 
| 34 | 
            +
                        return self
         | 
| 35 | 
            +
                      end
         | 
| 36 | 
            +
                    end
         | 
| 37 | 
            +
             | 
| 38 | 
            +
                  end
         | 
| 39 | 
            +
                end
         | 
| 40 | 
            +
              end
         | 
| 41 | 
            +
            end
         | 
| @@ -0,0 +1,41 @@ | |
| 1 | 
            +
            module Moceansdk
         | 
| 2 | 
            +
              module Modules
         | 
| 3 | 
            +
                module Command
         | 
| 4 | 
            +
                  module McObject
         | 
| 5 | 
            +
             | 
| 6 | 
            +
                    class TgSendPhoto < AbstractMc
         | 
| 7 | 
            +
                      def action
         | 
| 8 | 
            +
                        'send-telegram'
         | 
| 9 | 
            +
                      end
         | 
| 10 | 
            +
             | 
| 11 | 
            +
                      def required_key
         | 
| 12 | 
            +
                        ['from','to','content']
         | 
| 13 | 
            +
                      end
         | 
| 14 | 
            +
             | 
| 15 | 
            +
                      def from(from, contact_type = 'bot_username')
         | 
| 16 | 
            +
                        @params[:'from'] = {}
         | 
| 17 | 
            +
                        @params[:'from'][:'id'] = from
         | 
| 18 | 
            +
                        @params[:'from'][:'type'] = contact_type
         | 
| 19 | 
            +
                        return self
         | 
| 20 | 
            +
                      end
         | 
| 21 | 
            +
             | 
| 22 | 
            +
                      def to(to, contact_type = "chat_id")
         | 
| 23 | 
            +
                        @params[:'to'] = {}
         | 
| 24 | 
            +
                        @params[:'to'][:'id'] = to
         | 
| 25 | 
            +
                        @params[:'to'][:'type'] = contact_type
         | 
| 26 | 
            +
                        return self
         | 
| 27 | 
            +
                      end
         | 
| 28 | 
            +
             | 
| 29 | 
            +
                      def content(url,text)
         | 
| 30 | 
            +
                        @params[:'content'] = {}
         | 
| 31 | 
            +
                        @params[:'content'][:'rich_media_url'] = url
         | 
| 32 | 
            +
                        @params[:'content'][:'text'] = text
         | 
| 33 | 
            +
                        @params[:'content'][:'type'] = 'photo'
         | 
| 34 | 
            +
                        return self
         | 
| 35 | 
            +
                      end
         | 
| 36 | 
            +
                    end
         | 
| 37 | 
            +
             | 
| 38 | 
            +
                  end
         | 
| 39 | 
            +
                end
         | 
| 40 | 
            +
              end
         | 
| 41 | 
            +
            end
         | 
| @@ -0,0 +1,41 @@ | |
| 1 | 
            +
            module Moceansdk
         | 
| 2 | 
            +
              module Modules
         | 
| 3 | 
            +
                module Command
         | 
| 4 | 
            +
                  module McObject
         | 
| 5 | 
            +
             | 
| 6 | 
            +
                    class TgSendText < AbstractMc
         | 
| 7 | 
            +
                      def action
         | 
| 8 | 
            +
                        'send-telegram'
         | 
| 9 | 
            +
                      end
         | 
| 10 | 
            +
             | 
| 11 | 
            +
                      def required_key
         | 
| 12 | 
            +
                        ['from','to','content']
         | 
| 13 | 
            +
                      end
         | 
| 14 | 
            +
             | 
| 15 | 
            +
                      def from(from, contact_type = 'bot_username')
         | 
| 16 | 
            +
                        @params[:'from'] = {}
         | 
| 17 | 
            +
                        @params[:'from'][:'id'] = from
         | 
| 18 | 
            +
                        @params[:'from'][:'type'] = contact_type
         | 
| 19 | 
            +
                        return self
         | 
| 20 | 
            +
                      end
         | 
| 21 | 
            +
             | 
| 22 | 
            +
                      def to(to, contact_type = "chat_id")
         | 
| 23 | 
            +
                        @params[:'to'] = {}
         | 
| 24 | 
            +
                        @params[:'to'][:'id'] = to
         | 
| 25 | 
            +
                        @params[:'to'][:'type'] = contact_type
         | 
| 26 | 
            +
                        return self
         | 
| 27 | 
            +
                      end
         | 
| 28 | 
            +
             | 
| 29 | 
            +
                      def content(text)
         | 
| 30 | 
            +
                        @params[:'content'] = {}
         | 
| 31 | 
            +
                        @params[:'content'][:'text'] = text
         | 
| 32 | 
            +
                        @params[:'content'][:'type'] = 'text'
         | 
| 33 | 
            +
                        return self
         | 
| 34 | 
            +
                      end
         | 
| 35 | 
            +
             | 
| 36 | 
            +
                    end
         | 
| 37 | 
            +
             | 
| 38 | 
            +
                  end
         | 
| 39 | 
            +
                end
         | 
| 40 | 
            +
              end
         | 
| 41 | 
            +
            end
         | 
| @@ -0,0 +1,41 @@ | |
| 1 | 
            +
            module Moceansdk
         | 
| 2 | 
            +
              module Modules
         | 
| 3 | 
            +
                module Command
         | 
| 4 | 
            +
                  module McObject
         | 
| 5 | 
            +
             | 
| 6 | 
            +
                    class TgSendVideo < AbstractMc
         | 
| 7 | 
            +
                      def action
         | 
| 8 | 
            +
                        'send-telegram'
         | 
| 9 | 
            +
                      end
         | 
| 10 | 
            +
             | 
| 11 | 
            +
                      def required_key
         | 
| 12 | 
            +
                        ['from','to','content']
         | 
| 13 | 
            +
                      end
         | 
| 14 | 
            +
             | 
| 15 | 
            +
                      def from(from, contact_type = 'bot_username')
         | 
| 16 | 
            +
                        @params[:'from'] = {}
         | 
| 17 | 
            +
                        @params[:'from'][:'id'] = from
         | 
| 18 | 
            +
                        @params[:'from'][:'type'] = contact_type
         | 
| 19 | 
            +
                        return self
         | 
| 20 | 
            +
                      end
         | 
| 21 | 
            +
             | 
| 22 | 
            +
                      def to(to, contact_type = "chat_id")
         | 
| 23 | 
            +
                        @params[:'to'] = {}
         | 
| 24 | 
            +
                        @params[:'to'][:'id'] = to
         | 
| 25 | 
            +
                        @params[:'to'][:'type'] = contact_type
         | 
| 26 | 
            +
                        return self
         | 
| 27 | 
            +
                      end
         | 
| 28 | 
            +
             | 
| 29 | 
            +
                      def content(url,text)
         | 
| 30 | 
            +
                        @params[:'content'] = {}
         | 
| 31 | 
            +
                        @params[:'content'][:'rich_media_url'] = url
         | 
| 32 | 
            +
                        @params[:'content'][:'text'] = text
         | 
| 33 | 
            +
                        @params[:'content'][:'type'] = 'video'
         | 
| 34 | 
            +
                        return self
         | 
| 35 | 
            +
                      end
         | 
| 36 | 
            +
                    end
         | 
| 37 | 
            +
             | 
| 38 | 
            +
                  end
         | 
| 39 | 
            +
                end
         | 
| 40 | 
            +
              end
         | 
| 41 | 
            +
            end
         | 
    
        data/lib/moceansdk/version.rb
    CHANGED
    
    
    
        data/moceansdk.gemspec
    CHANGED
    
    | @@ -11,7 +11,7 @@ Gem::Specification.new do |s| | |
| 11 11 | 
             
              s.description = 'Mocean SDK for Ruby'
         | 
| 12 12 | 
             
              s.summary = 'This is a Mocean SDK written in Ruby, to use it you will need a mocean account. Signup for free at https://moceanapi.com'
         | 
| 13 13 | 
             
              s.files = Dir.glob('lib/**/*.rb') + %w(LICENSE.txt README.md moceansdk.gemspec)
         | 
| 14 | 
            -
              s.required_ruby_version = '>= 2. | 
| 14 | 
            +
              s.required_ruby_version = '>= 2.3.0'
         | 
| 15 15 | 
             
              s.add_dependency('hash_dot', '~> 2.4')
         | 
| 16 16 | 
             
              s.add_dependency('http', '>= 3', '< 5')
         | 
| 17 17 | 
             
              s.add_dependency('xml-simple', '~> 1.1')
         | 
    
        metadata
    CHANGED
    
    | @@ -1,14 +1,14 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: moceansdk
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 1.1. | 
| 4 | 
            +
              version: 1.1.1
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Micro Ocean Technologies Sdn Bhd
         | 
| 8 8 | 
             
            autorequire: 
         | 
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 | 
            -
            date:  | 
| 11 | 
            +
            date: 2021-03-19 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: hash_dot
         | 
| @@ -132,6 +132,18 @@ files: | |
| 132 132 | 
             
            - lib/moceansdk/modules/abstact_client.rb
         | 
| 133 133 | 
             
            - lib/moceansdk/modules/account/balance.rb
         | 
| 134 134 | 
             
            - lib/moceansdk/modules/account/pricing.rb
         | 
| 135 | 
            +
            - lib/moceansdk/modules/command/command.rb
         | 
| 136 | 
            +
            - lib/moceansdk/modules/command/mc.rb
         | 
| 137 | 
            +
            - lib/moceansdk/modules/command/mc_builder.rb
         | 
| 138 | 
            +
            - lib/moceansdk/modules/command/mc_object/abstract_mc.rb
         | 
| 139 | 
            +
            - lib/moceansdk/modules/command/mc_object/send_sms.rb
         | 
| 140 | 
            +
            - lib/moceansdk/modules/command/mc_object/tg_request_contact.rb
         | 
| 141 | 
            +
            - lib/moceansdk/modules/command/mc_object/tg_send_animation.rb
         | 
| 142 | 
            +
            - lib/moceansdk/modules/command/mc_object/tg_send_audio.rb
         | 
| 143 | 
            +
            - lib/moceansdk/modules/command/mc_object/tg_send_document.rb
         | 
| 144 | 
            +
            - lib/moceansdk/modules/command/mc_object/tg_send_photo.rb
         | 
| 145 | 
            +
            - lib/moceansdk/modules/command/mc_object/tg_send_text.rb
         | 
| 146 | 
            +
            - lib/moceansdk/modules/command/mc_object/tg_send_video.rb
         | 
| 135 147 | 
             
            - lib/moceansdk/modules/message/channel.rb
         | 
| 136 148 | 
             
            - lib/moceansdk/modules/message/message_status.rb
         | 
| 137 149 | 
             
            - lib/moceansdk/modules/message/sms.rb
         | 
| @@ -167,15 +179,14 @@ required_ruby_version: !ruby/object:Gem::Requirement | |
| 167 179 | 
             
              requirements:
         | 
| 168 180 | 
             
              - - ">="
         | 
| 169 181 | 
             
                - !ruby/object:Gem::Version
         | 
| 170 | 
            -
                  version: 2. | 
| 182 | 
            +
                  version: 2.3.0
         | 
| 171 183 | 
             
            required_rubygems_version: !ruby/object:Gem::Requirement
         | 
| 172 184 | 
             
              requirements:
         | 
| 173 185 | 
             
              - - ">="
         | 
| 174 186 | 
             
                - !ruby/object:Gem::Version
         | 
| 175 187 | 
             
                  version: '0'
         | 
| 176 188 | 
             
            requirements: []
         | 
| 177 | 
            -
             | 
| 178 | 
            -
            rubygems_version: 2.7.7
         | 
| 189 | 
            +
            rubygems_version: 3.1.4
         | 
| 179 190 | 
             
            signing_key: 
         | 
| 180 191 | 
             
            specification_version: 4
         | 
| 181 192 | 
             
            summary: This is a Mocean SDK written in Ruby, to use it you will need a mocean account.
         |