Class: SmsRu::Call

Inherits:
Object
  • Object
show all
Defined in:
lib/sms_ru/data.rb

Overview

Result of SmsRu#call (flash call). ‘code` is the last 4 digits of the number that calls the user — what they read off the incoming call and enter.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#balanceFloat (readonly)

Returns the account balance after the call.

Returns:

  • (Float)

    the account balance after the call



168
169
170
171
172
173
174
175
176
177
178
179
# File 'lib/sms_ru/data.rb', line 168

class Call < Data.define(:code, :call_id, :cost, :balance)
  # @param hash [Hash] the parsed /code/call response
  # @return [SmsRu::Call]
  def self.build(hash)
    new(
      code: Coerce.string(hash["code"]),
      call_id: Coerce.string(hash["call_id"]),
      cost: Coerce.float(hash["cost"]),
      balance: Coerce.float(hash["balance"])
    )
  end
end

#call_idString (readonly)

Returns the call id assigned by SMS.ru.

Returns:

  • (String)

    the call id assigned by SMS.ru



168
169
170
171
172
173
174
175
176
177
178
179
# File 'lib/sms_ru/data.rb', line 168

class Call < Data.define(:code, :call_id, :cost, :balance)
  # @param hash [Hash] the parsed /code/call response
  # @return [SmsRu::Call]
  def self.build(hash)
    new(
      code: Coerce.string(hash["code"]),
      call_id: Coerce.string(hash["call_id"]),
      cost: Coerce.float(hash["cost"]),
      balance: Coerce.float(hash["balance"])
    )
  end
end

#codeString (readonly)

Returns the 4-digit code (the calling number’s last 4 digits).

Returns:

  • (String)

    the 4-digit code (the calling number’s last 4 digits)



168
169
170
171
172
173
174
175
176
177
178
179
# File 'lib/sms_ru/data.rb', line 168

class Call < Data.define(:code, :call_id, :cost, :balance)
  # @param hash [Hash] the parsed /code/call response
  # @return [SmsRu::Call]
  def self.build(hash)
    new(
      code: Coerce.string(hash["code"]),
      call_id: Coerce.string(hash["call_id"]),
      cost: Coerce.float(hash["cost"]),
      balance: Coerce.float(hash["balance"])
    )
  end
end

#costFloat (readonly)

Returns the price of the call.

Returns:

  • (Float)

    the price of the call



168
169
170
171
172
173
174
175
176
177
178
179
# File 'lib/sms_ru/data.rb', line 168

class Call < Data.define(:code, :call_id, :cost, :balance)
  # @param hash [Hash] the parsed /code/call response
  # @return [SmsRu::Call]
  def self.build(hash)
    new(
      code: Coerce.string(hash["code"]),
      call_id: Coerce.string(hash["call_id"]),
      cost: Coerce.float(hash["cost"]),
      balance: Coerce.float(hash["balance"])
    )
  end
end

Class Method Details

.build(hash) ⇒ SmsRu::Call

Parameters:

  • hash (Hash)

    the parsed /code/call response

Returns:



171
172
173
174
175
176
177
178
# File 'lib/sms_ru/data.rb', line 171

def self.build(hash)
  new(
    code: Coerce.string(hash["code"]),
    call_id: Coerce.string(hash["call_id"]),
    cost: Coerce.float(hash["cost"]),
    balance: Coerce.float(hash["balance"])
  )
end