smster 0.0.3 → 0.5.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5b8fdbd8765029fc596f9e57a805d1a0aa447700
4
- data.tar.gz: 05d2aa2be015b4f8c2f3da8a380c78c756ba552f
3
+ metadata.gz: 0b4a43ae5bd049ae49c9ddcd6eca1dd1478e160b
4
+ data.tar.gz: 70a88091d388966c6555309f0f49ed1ed63c148d
5
5
  SHA512:
6
- metadata.gz: 0e9d1c06b35deddab86e0bd9af9f943312507b0470ffb3596685e9ab69427539b65540461eac5c4a7193d9fbf9cc5100878353ea7a94a1df6cbf4966408f34b6
7
- data.tar.gz: 6d225c10f117735b82a6a4565117a5b4f89806c24194109aaf3e576e2b1204c495382d92aacc6f3c2d30bcae42e175bc43d484dea09cb5af39ee9ccbec058c6a
6
+ metadata.gz: e6ba1c25cf27a1ee741ffa9cd2664254a6cada3cf2b36b57f7f7c7701fa86d1f2a2daf993f208c61cbb5c9e97d92c24483608f7f36e9b42bd4c35fab4190097f
7
+ data.tar.gz: 973c0fac4f1e4a4e6d8e3f752432205098e30f535a1022e3a1b5a659f9e81fded037a57ec4375f32d512573e65fe6ae6634d1d3a00d21c62eb38d206d5c4f03b
@@ -25,7 +25,7 @@ Add to routes, setup provider callbacks and get sms statuses:
25
25
  post 'smster/$provider_name/callback'
26
26
 
27
27
  == Feedback
28
- Please use the {issue tracker}[https://github.com/IlyaDonskikh/smster/issues].
28
+ Please use the {issue tracker}[https://github.com/IlyaDonskikh/smster/issues] or send mail to {donivrecord@gmail.com}[mailto:donivrecord@gmail.com].
29
29
 
30
30
  == Thanks
31
31
  1. {Mickhail Zelenin}[https://github.com/MioGreen] for the idea for this gem.
data/Rakefile CHANGED
@@ -14,11 +14,6 @@ RDoc::Task.new(:rdoc) do |rdoc|
14
14
  rdoc.rdoc_files.include('lib/**/*.rb')
15
15
  end
16
16
 
17
-
18
-
19
-
20
-
21
-
22
17
  Bundler::GemHelper.install_tasks
23
18
 
24
19
  require 'rake/testtask'
@@ -30,5 +25,4 @@ Rake::TestTask.new(:test) do |t|
30
25
  t.verbose = false
31
26
  end
32
27
 
33
-
34
28
  task default: :test
@@ -4,6 +4,7 @@ class Smster::ClickatellController < ApplicationController
4
4
  def callback
5
5
  code = clickatell_params[:apiMessageId]
6
6
  description = clickatell_params[:description]
7
+
7
8
  sms = Sms::Clickatell.find_by!(code: code)
8
9
 
9
10
  sms.status_message = description
@@ -16,7 +17,8 @@ class Smster::ClickatellController < ApplicationController
16
17
  end
17
18
 
18
19
  private
20
+
19
21
  def clickatell_params
20
22
  params.require(:data)
21
23
  end
22
- end
24
+ end
@@ -10,8 +10,8 @@ class Smster::NexmoController < ApplicationController
10
10
  sms.save
11
11
 
12
12
  sms.accept! if status == 'delivered'
13
- result = { sms.id => sms.status }
14
13
 
14
+ result = { sms.id => sms.status }
15
15
  render json: result.as_json, status: 200
16
16
  end
17
- end
17
+ end
@@ -4,23 +4,24 @@ class Smster::SmsruController < ApplicationController
4
4
  def callback
5
5
  smsru_params.each do |data|
6
6
  data = data.split(/\n/)
7
- if data[0] == 'sms_status'
8
- code = data[1]
9
- status = data[2]
10
- @sms = Sms::Smsru.find_by!(code: code)
11
7
 
12
- @sms.status_message = status
13
- @sms.save
8
+ next unless data[0] == 'sms_status'
14
9
 
15
- @sms.accept! if status.to_s == '100'
16
- end
10
+ code = data[1]
11
+ status = data[2]
12
+ @sms = Sms::Smsru.find_by!(code: code)
13
+
14
+ @sms.update(status_message: status)
15
+
16
+ @sms.accept! if status.to_s == '100'
17
17
  end
18
18
 
19
19
  render nothing: true, status: 100
20
20
  end
21
21
 
22
22
  private
23
+
23
24
  def smsru_params
24
25
  params.require(:data)
25
26
  end
26
- end
27
+ end
@@ -1,4 +1,4 @@
1
- class CreateSmsters< ActiveRecord::Migration
1
+ class CreateSmsters < ActiveRecord::Migration
2
2
  def up
3
3
  create_table :smsters do |t|
4
4
  t.string :text
@@ -17,4 +17,4 @@ class CreateSmsters< ActiveRecord::Migration
17
17
  def down
18
18
  drop_table :smsters
19
19
  end
20
- end
20
+ end
@@ -1,11 +1,11 @@
1
1
  Smster.configure do |config|
2
2
  ## Nexmo
3
- config.nexmo_key = ""
4
- config.nexmo_sekret = ""
3
+ config.nexmo_key = ''
4
+ config.nexmo_sekret = ''
5
5
 
6
6
  ## Clickatell
7
- config.clickatell_authorization_code = ""
7
+ config.clickatell_authorization_code = ''
8
8
 
9
9
  ## Smsru
10
- config.smsru_api_id = ""
11
- end
10
+ config.smsru_api_id = ''
11
+ end
@@ -1,19 +1,19 @@
1
1
  require 'rails/generators'
2
2
  module Smster
3
3
  class InstallGenerator < Rails::Generators::Base
4
- desc "Add migration"
4
+ desc 'Add migration'
5
5
  include Rails::Generators::Migration
6
6
  source_root File.expand_path('../install/templates', __FILE__)
7
7
 
8
8
  def copy_migrations
9
- copy_migration "create_smsters"
9
+ copy_migration 'create_smsters'
10
10
  end
11
11
 
12
- def self.next_migration_number(path)
13
- unless @prev_migration_nr
14
- @prev_migration_nr = Time.now.utc.strftime("%Y%m%d%H%M%S").to_i
15
- else
12
+ def self.next_migration_number(_)
13
+ if @prev_migration_nr
16
14
  @prev_migration_nr += 1
15
+ else
16
+ @prev_migration_nr = Time.now.utc.strftime('%Y%m%d%H%M%S').to_i
17
17
  end
18
18
  @prev_migration_nr.to_s
19
19
  end
@@ -27,9 +27,10 @@ module Smster
27
27
  end
28
28
 
29
29
  protected
30
+
30
31
  def copy_migration(filename)
31
- if self.class.migration_exists?("db/migrate", "#{filename}")
32
- say_status("skipped", "Migration #{filename}.rb already exists")
32
+ if self.class.migration_exists?('db/migrate', "#{filename}")
33
+ say_status('skipped', "Migration #{filename}.rb already exists")
33
34
  else
34
35
  migration_template "#{filename}.rb", "db/migrate/#{filename}.rb"
35
36
  end
@@ -1,13 +1,14 @@
1
1
  require 'rest_client'
2
- require "smster/configuration"
2
+ require 'smster'
3
+ require 'smster/configuration'
3
4
  require 'smster/sms'
4
- require 'smster/sms/clickatell'
5
- require 'smster/sms/nexmo'
6
5
  require 'smster/sms/smsru'
6
+ require 'smster/sms/nexmo'
7
+ require 'smster/sms/clickatell'
7
8
 
8
9
  module Smster
9
10
  class Engine < Rails::Engine; end
10
-
11
+
11
12
  class << self
12
13
  attr_accessor :configuration
13
14
  end
@@ -1,32 +1,50 @@
1
1
  class Sms < ActiveRecord::Base
2
- self.table_name = "smsters"
3
- attr_accessor :mode
2
+ self.table_name = 'smsters'
4
3
 
5
- ## Codes
6
- STATUS_CODES = { created: 0, sent: 1, delivered: 2, failed: 3 }
4
+ attr_accessor :from, :api_message_id
7
5
 
8
6
  ## Callbacks
9
- after_create :send_sms
7
+ before_validation :assing_status
10
8
 
11
- ## Validations
12
- validates :type, :to, :text, presence: true
9
+ ## Codes
10
+ STATUSES = { created: 0, sent: 1, delivered: 2, failed: 3 }
13
11
 
14
12
  ## Etc.
15
- def initialize(attributes = {})
16
- attr_with_defaults = {
17
- status: STATUS_CODES[:created]
18
- }.merge(attributes)
19
- super(attr_with_defaults)
13
+ def self.create(attrs = {})
14
+ sms = new(attrs).send_sms
15
+ sms.assing_code
16
+ sms.save
17
+
18
+ sms
20
19
  end
21
20
 
22
- def mode
23
- @mode ||= case Rails.env
24
- when 'test' then 'test'
25
- else 'production'
26
- end
21
+ def assing_status
22
+ self.status ||= STATUSES[:created]
23
+ end
24
+
25
+ def send_sms
26
+ send_to_provider
27
+
28
+ status_name = api_message_id ? :sent : :failed
29
+ self.status = STATUSES[status_name]
30
+
31
+ self
27
32
  end
28
33
 
29
34
  def accept!
30
- self.update(status: STATUS_CODES[:delivered])
35
+ update(status: STATUSES[:delivered])
36
+ end
37
+
38
+ def assing_code
39
+ self.code = api_message_id
31
40
  end
32
- end
41
+
42
+ private
43
+
44
+ def send_to_provider
45
+ modify_params
46
+
47
+ response = send_request
48
+ assign_attrs_by(response)
49
+ end
50
+ end
@@ -1,3 +1,3 @@
1
1
  module Smster
2
- VERSION = "0.0.3"
2
+ VERSION = '0.5.0'
3
3
  end
@@ -2,26 +2,35 @@ require 'test_helper'
2
2
 
3
3
  class Smster::ClickatellControllerTest < ActionController::TestCase
4
4
  def setup
5
- @text = "simple text"
6
- @number = (0...7).map { (1..9).to_a.sample }.join
5
+ @text = 'simple text'
6
+ @to = (9_999_999 * rand).to_i
7
7
  @provider = Sms::Clickatell
8
+
9
+ stub_send_request
8
10
  end
9
11
 
10
12
  test 'callback' do
11
- delivered_code = Sms::STATUS_CODES[:delivered]
12
- sms = @provider.create(text: @text, to: @number)
13
-
14
- post :callback, {
15
- "data" => {
16
- "charge" => 1.5,
17
- "messageStatus" => 003,
18
- "description" => "Received by recipient",
19
- "apiMessageId" => sms.code
20
- }
13
+ delivered_code = Sms::STATUSES[:delivered]
14
+ sms = @provider.create(text: @text, to: @to)
15
+
16
+ post :callback, 'data' => {
17
+ 'charge' => 1.5,
18
+ 'messageStatus' => 003,
19
+ 'description' => 'Received by recipient',
20
+ 'apiMessageId' => sms.code
21
21
  }
22
22
 
23
23
  response = JSON.parse(@response.body)
24
24
  result = { sms.id => delivered_code }
25
25
  assert_equal result.as_json, response
26
26
  end
27
- end
27
+
28
+ private
29
+
30
+ def stub_send_request
31
+ body = { data: { message: ['apiMessageId' => 15] } }.to_json
32
+
33
+ stub_request(:post, 'https://api.clickatell.com/rest/message')
34
+ .to_return(status: 200, body: body, headers: {})
35
+ end
36
+ end
@@ -2,18 +2,31 @@ require 'test_helper'
2
2
 
3
3
  class Smster::NexmoControllerTest < ActionController::TestCase
4
4
  def setup
5
- @text = "simple text"
6
- @number = (0...7).map { (1..9).to_a.sample }.join
5
+ @text = 'simple text'
6
+ @number = (9_999_999 * rand).to_i
7
7
  @provider = Sms::Nexmo
8
+
9
+ stub_send_request
8
10
  end
9
11
 
10
12
  test 'callback' do
11
- delivered_code = Sms::STATUS_CODES[:delivered]
13
+ delivered_code = Sms::STATUSES[:delivered]
12
14
  sms = @provider.create(text: @text, to: @number)
13
15
 
14
- post :callback, { "messageId" => sms.code, "status" => 'delivered' }
16
+ post :callback, 'messageId' => sms.code, 'status' => 'delivered'
17
+
15
18
  response = JSON.parse(@response.body)
16
19
  result = { sms.id => delivered_code }
20
+
17
21
  assert_equal result.as_json, response
18
22
  end
19
- end
23
+
24
+ private
25
+
26
+ def stub_send_request
27
+ body = { messages: ['message-id' => 15] }.to_json
28
+
29
+ stub_request(:post, 'https://rest.nexmo.com/sms/json')
30
+ .to_return(status: 200, body: body, headers: {})
31
+ end
32
+ end
@@ -2,22 +2,30 @@ require 'test_helper'
2
2
 
3
3
  class Smster::SmsruControllerTest < ActionController::TestCase
4
4
  def setup
5
- @text = "simple text"
6
- @number = (0...7).map { (1..9).to_a.sample }.join
5
+ @text = 'simple text'
6
+ @to = (9_999_999 * rand).to_i
7
7
  @provider = Sms::Smsru
8
+
9
+ stub_send_request
8
10
  end
9
11
 
10
12
  test 'callback' do
11
- delivered_code = Sms::STATUS_CODES[:delivered]
12
- sms = @provider.create(text: @text, to: @number)
13
+ delivered_code = Sms::STATUSES[:delivered]
14
+ sms = @provider.create(text: @text, to: @to)
13
15
 
14
- post :callback, {
15
- "data" => ["sms_status\n#{sms.code}\n100"]
16
- }
16
+ post :callback, 'data' => ["sms_status\n#{sms.code}\n100"]
17
17
 
18
- response = @response.status
19
18
  sms = assigns(:sms)
20
19
  assert_equal 100, @response.status
21
20
  assert_equal delivered_code, sms.status
22
21
  end
23
- end
22
+
23
+ private
24
+
25
+ def stub_send_request
26
+ body = "100\n201523-1000007\nbalance=52.54"
27
+
28
+ stub_request(:post, 'http://sms.ru/sms/send')
29
+ .to_return(status: 200, body: body, headers: {})
30
+ end
31
+ end
@@ -1,6 +1,3 @@
1
- # Add your own tasks in files placed in lib/tasks ending in .rake,
2
- # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
-
4
1
  require File.expand_path('../config/application', __FILE__)
5
2
 
6
3
  Rails.application.load_tasks
@@ -7,5 +7,5 @@ Smster.configure do |config|
7
7
  config.clickatell_authorization_code = "I._aJiuBBZW6K8A_V6jh34tJLt7eghOlMrgsiCrK3ze63hxFpe8n5.7PY1PNStxLIn"
8
8
 
9
9
  ## Smsru
10
- config.smsru_api_id = "1b9812ac9-c035-04f4-45e6-2ad22d375cb9"
10
+ config.smsru_api_id = "b9812ac9-c035-04f4-45e6-2ad22d375cb9"
11
11
  end
@@ -269,3 +269,52 @@ Error Unroutable message - rejected
269
269
  SQL (0.4ms) INSERT INTO "smsters" ("type", "status", "to", "text", "created_at", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["type", "Sms::Nexmo"], ["status", 0], ["to", "79050958806"], ["text", "privet1"], ["created_at", "2015-04-01 05:17:32.611427"], ["updated_at", "2015-04-01 05:17:32.611427"]]
270
270
  SQL (0.4ms) UPDATE "smsters" SET "type" = ?, "status" = ?, "to" = ?, "text" = ?, "created_at" = ?, "updated_at" = ?, "id" = ?, "code" = ? WHERE "smsters"."id" = ? [["type", "Sms::Nexmo"], ["status", 1], ["to", "79050958806"], ["text", "privet1"], ["created_at", "2015-04-01 05:17:32.611427"], ["updated_at", "2015-04-01 05:17:32.611427"], ["id", 53], ["code", "0200000059FADD5B"], ["id", 53]]
271
271
   (2.6ms) commit transaction
272
+  (0.1ms) begin transaction
273
+ SQL (1.4ms) INSERT INTO "smsters" ("type", "status", "text", "to", "created_at", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["type", "Sms::Smsru"], ["status", 0], ["text", "Hello"], ["to", "+79050958806"], ["created_at", "2015-05-31 12:09:45.034566"], ["updated_at", "2015-05-31 12:09:45.034566"]]
274
+ Error 200
275
+ SQL (0.5ms) UPDATE "smsters" SET "type" = ?, "status" = ?, "text" = ?, "to" = ?, "created_at" = ?, "updated_at" = ?, "id" = ?, "status_message" = ? WHERE "smsters"."id" = ? [["type", "Sms::Smsru"], ["status", 3], ["text", "Hello"], ["to", "+79050958806"], ["created_at", "2015-05-31 12:09:45.034566"], ["updated_at", "2015-05-31 12:09:45.034566"], ["id", 54], ["status_message", "200"], ["id", 54]]
276
+  (2.7ms) commit transaction
277
+  (0.1ms) begin transaction
278
+ SQL (0.4ms) INSERT INTO "smsters" ("type", "status", "text", "to", "created_at", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["type", "Sms::Smsru"], ["status", 0], ["text", "Hello"], ["to", "79050958806"], ["created_at", "2015-05-31 12:10:16.078787"], ["updated_at", "2015-05-31 12:10:16.078787"]]
279
+ Error 200
280
+ SQL (0.4ms) UPDATE "smsters" SET "type" = ?, "status" = ?, "text" = ?, "to" = ?, "created_at" = ?, "updated_at" = ?, "id" = ?, "status_message" = ? WHERE "smsters"."id" = ? [["type", "Sms::Smsru"], ["status", 3], ["text", "Hello"], ["to", "79050958806"], ["created_at", "2015-05-31 12:10:16.078787"], ["updated_at", "2015-05-31 12:10:16.078787"], ["id", 55], ["status_message", "200"], ["id", 55]]
281
+  (2.8ms) commit transaction
282
+ Error 200
283
+  (0.1ms) begin transaction
284
+ SQL (0.4ms) INSERT INTO "smsters" ("type", "status", "text", "to", "status_message", "created_at", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?) [["type", "Sms::Smsru"], ["status", 3], ["text", "Hello"], ["to", "79050958806"], ["status_message", "200"], ["created_at", "2015-05-31 12:10:28.340706"], ["updated_at", "2015-05-31 12:10:28.340706"]]
285
+ Error 200
286
+ SQL (0.5ms) UPDATE "smsters" SET "type" = ?, "status" = ?, "text" = ?, "to" = ?, "status_message" = ?, "created_at" = ?, "updated_at" = ?, "id" = ? WHERE "smsters"."id" = ? [["type", "Sms::Smsru"], ["status", 3], ["text", "Hello"], ["to", "79050958806"], ["status_message", "200"], ["created_at", "2015-05-31 12:10:28.340706"], ["updated_at", "2015-05-31 12:10:28.340706"], ["id", 56], ["id", 56]]
287
+  (2.8ms) commit transaction
288
+ Error 200
289
+  (0.1ms) begin transaction
290
+ SQL (0.3ms) INSERT INTO "smsters" ("type", "status", "text", "to", "status_message", "created_at", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?) [["type", "Sms::Smsru"], ["status", 3], ["text", "Hello"], ["to", "+79050958806"], ["status_message", "200"], ["created_at", "2015-05-31 12:11:01.823444"], ["updated_at", "2015-05-31 12:11:01.823444"]]
291
+ Error 200
292
+ SQL (0.3ms) UPDATE "smsters" SET "type" = ?, "status" = ?, "text" = ?, "to" = ?, "status_message" = ?, "created_at" = ?, "updated_at" = ?, "id" = ? WHERE "smsters"."id" = ? [["type", "Sms::Smsru"], ["status", 3], ["text", "Hello"], ["to", "+79050958806"], ["status_message", "200"], ["created_at", "2015-05-31 12:11:01.823444"], ["updated_at", "2015-05-31 12:11:01.823444"], ["id", 57], ["id", 57]]
293
+  (0.9ms) commit transaction
294
+ Error 200
295
+  (0.1ms) begin transaction
296
+ SQL (0.4ms) INSERT INTO "smsters" ("type", "status", "text", "to", "status_message", "created_at", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?) [["type", "Sms::Smsru"], ["status", 3], ["text", "Hello"], ["to", "+79050958806"], ["status_message", "200"], ["created_at", "2015-05-31 12:11:28.359710"], ["updated_at", "2015-05-31 12:11:28.359710"]]
297
+ Error 200
298
+ SQL (0.4ms) UPDATE "smsters" SET "type" = ?, "status" = ?, "text" = ?, "to" = ?, "status_message" = ?, "created_at" = ?, "updated_at" = ?, "id" = ? WHERE "smsters"."id" = ? [["type", "Sms::Smsru"], ["status", 3], ["text", "Hello"], ["to", "+79050958806"], ["status_message", "200"], ["created_at", "2015-05-31 12:11:28.359710"], ["updated_at", "2015-05-31 12:11:28.359710"], ["id", 58], ["id", 58]]
299
+  (2.7ms) commit transaction
300
+ Error 200
301
+  (0.1ms) begin transaction
302
+ SQL (2.0ms) INSERT INTO "smsters" ("type", "status", "text", "to", "status_message", "created_at", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?) [["type", "Sms::Smsru"], ["status", 3], ["text", "Hello"], ["to", "+79050958806"], ["status_message", "200"], ["created_at", "2015-05-31 12:12:05.400871"], ["updated_at", "2015-05-31 12:12:05.400871"]]
303
+ Error 200
304
+ SQL (2.2ms) UPDATE "smsters" SET "type" = ?, "status" = ?, "text" = ?, "to" = ?, "status_message" = ?, "created_at" = ?, "updated_at" = ?, "id" = ? WHERE "smsters"."id" = ? [["type", "Sms::Smsru"], ["status", 3], ["text", "Hello"], ["to", "+79050958806"], ["status_message", "200"], ["created_at", "2015-05-31 12:12:05.400871"], ["updated_at", "2015-05-31 12:12:05.400871"], ["id", 59], ["id", 59]]
305
+  (1.3ms) commit transaction
306
+ Error 200
307
+  (0.1ms) begin transaction
308
+ SQL (0.6ms) INSERT INTO "smsters" ("type", "status", "text", "to", "status_message", "created_at", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?) [["type", "Sms::Smsru"], ["status", 3], ["text", "Hello"], ["to", "+79050958806"], ["status_message", "200"], ["created_at", "2015-05-31 12:12:18.887816"], ["updated_at", "2015-05-31 12:12:18.887816"]]
309
+ Error 200
310
+ SQL (0.6ms) UPDATE "smsters" SET "type" = ?, "status" = ?, "text" = ?, "to" = ?, "status_message" = ?, "created_at" = ?, "updated_at" = ?, "id" = ? WHERE "smsters"."id" = ? [["type", "Sms::Smsru"], ["status", 3], ["text", "Hello"], ["to", "+79050958806"], ["status_message", "200"], ["created_at", "2015-05-31 12:12:18.887816"], ["updated_at", "2015-05-31 12:12:18.887816"], ["id", 60], ["id", 60]]
311
+  (1.1ms) commit transaction
312
+ Mode: production. To: 79050958806, text: Hello
313
+  (0.2ms) begin transaction
314
+ SQL (0.5ms) INSERT INTO "smsters" ("type", "status", "text", "to", "created_at", "updated_at") VALUES (?, ?, ?, ?, ?, ?) [["type", "Sms::Smsru"], ["status", 0], ["text", "Hello"], ["to", "+79050958806"], ["created_at", "2015-05-31 12:15:32.722614"], ["updated_at", "2015-05-31 12:15:32.722614"]]
315
+ Mode: production. To: 79050958806, text: Hello
316
+ SQL (0.6ms) UPDATE "smsters" SET "type" = ?, "status" = ?, "text" = ?, "to" = ?, "created_at" = ?, "updated_at" = ?, "id" = ? WHERE "smsters"."id" = ? [["type", "Sms::Smsru"], ["status", 0], ["text", "Hello"], ["to", "+79050958806"], ["created_at", "2015-05-31 12:15:32.722614"], ["updated_at", "2015-05-31 12:15:32.722614"], ["id", 61], ["id", 61]]
317
+  (0.9ms) commit transaction
318
+  (0.1ms) begin transaction
319
+ SQL (1.7ms) INSERT INTO "smsters" ("type", "to", "text", "status", "code", "created_at", "updated_at") VALUES (?, ?, ?, ?, ?, ?, ?) [["type", "Sms::Smsru"], ["to", "79050958806"], ["text", "test rails gem"], ["status", 1], ["code", "201525-1000000"], ["created_at", "2015-06-15 17:01:55.748243"], ["updated_at", "2015-06-15 17:01:55.748243"]]
320
+  (0.9ms) commit transaction