rs.ge 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -8,7 +8,7 @@
8
8
 
9
9
  გამოყენებისათვის უნდა ჩასვათ შემდეგი ხაზი თქვენს Gemfile-ში:
10
10
 
11
- gem 'rs'
11
+ gem 'rs.ge', '~> 0.0.1'
12
12
 
13
13
  შემდეგი გამოყენება ძალიან მარტივია:
14
14
 
data/lib/rs/dict.rb CHANGED
@@ -63,7 +63,7 @@ module RS
63
63
 
64
64
  protected
65
65
 
66
- def normalize_excise_name(name)
66
+ def self.normalize_excise_name(name)
67
67
  index = name =~ /\([0-9]+\)/
68
68
  index ? name[0..index-1].strip : name
69
69
  end
data/lib/rs/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  module RS
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
data/lib/rs/waybill.rb CHANGED
@@ -27,8 +27,9 @@ module RS
27
27
  class Waybill
28
28
  TRANSPORTATION_PAID_BY_BUYER = 1
29
29
  TRANSPORTATION_PAID_BY_SELLER = 2
30
- STATUS_START = 0
31
- STATUS_ACTIVE = 1
30
+ STATUS_SAVED = 0
31
+ STATUS_ACTIVE = 1
32
+ STATUS_INACTIVE = 2
32
33
  attr_accessor :id, :type, :status, :parent_id
33
34
  attr_accessor :seller_id # გამყიდველის უნიკალური კოდი
34
35
  attr_accessor :buyer_tin, :check_buyer_tin, :buyer_name
@@ -86,7 +87,7 @@ module RS
86
87
  # sp -- სერვისის მომხმარებლის პაროლი
87
88
  #
88
89
  # ინახავს ამ ზედნადებს და განაახლებს მის მონაცემებს.
89
- def save_waybill(waybill, params)
90
+ def self.save_waybill(waybill, params)
90
91
  RS.validate_presence_of(params, 'su', 'sp')
91
92
  client = RS.waybill_service
92
93
  response = client.request 'save_waybill' do |soap|
data/spec/rs/dict_spec.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  require 'spec_helper'
3
+ require 'rs'
3
4
 
4
5
  # excise codes
5
6
 
@@ -45,7 +46,7 @@ describe 'getting waybill types' do
45
46
  it { should_not be_empty }
46
47
  context 'first type' do
47
48
  subject { @types.first }
48
- it { should be_instance_of WaybillType }
49
+ it { should be_instance_of RS::WaybillType }
49
50
  its(:id) { should_not be_nil }
50
51
  its(:name) { should_not be_nil }
51
52
  its(:name) { should_not be_empty }
@@ -54,20 +55,20 @@ end
54
55
 
55
56
  def waybill_type_creation_test(id)
56
57
  context "WaybillType with ID=#{id}" do
57
- subject { WaybillType.create_from_id(id) }
58
- it { should be_instance_of WaybillType }
58
+ subject { RS::WaybillType.create_from_id(id) }
59
+ it { should be_instance_of RS::WaybillType }
59
60
  its(:id) { should == id }
60
- its(:name) { should == WaybillType::NAMES[id]}
61
+ its(:name) { should == RS::WaybillType::NAMES[id]}
61
62
  end
62
63
  end
63
64
 
64
- describe WaybillType do
65
- waybill_type_creation_test WaybillType::INNER
66
- waybill_type_creation_test WaybillType::TRANSPORTATION
67
- waybill_type_creation_test WaybillType::WITHOUT_TRANSPORTATION
68
- waybill_type_creation_test WaybillType::DISTRIBUTION
69
- waybill_type_creation_test WaybillType::RETURN
70
- waybill_type_creation_test WaybillType::SUB_WAYBILL
65
+ describe RS::WaybillType do
66
+ waybill_type_creation_test RS::WaybillType::INNER
67
+ waybill_type_creation_test RS::WaybillType::TRANSPORTATION
68
+ waybill_type_creation_test RS::WaybillType::WITHOUT_TRANSPORTATION
69
+ waybill_type_creation_test RS::WaybillType::DISTRIBUTION
70
+ waybill_type_creation_test RS::WaybillType::RETURN
71
+ waybill_type_creation_test RS::WaybillType::SUB_WAYBILL
71
72
  end
72
73
 
73
74
  # waybill units
@@ -82,7 +83,7 @@ describe 'getting waybill units' do
82
83
  context 'first unit' do
83
84
  subject{ @units.first }
84
85
  it { should_not be_nil }
85
- it { should be_instance_of WaybillUnit }
86
+ it { should be_instance_of RS::WaybillUnit }
86
87
  its(:id) { should_not be_nil }
87
88
  its(:name) { should_not be_nil }
88
89
  its(:name) { should_not be_empty }
@@ -101,7 +102,7 @@ describe 'getting transport types' do
101
102
  context 'first type' do
102
103
  subject { @types.first }
103
104
  it { should_not be_nil }
104
- it { should be_instance_of TransportType }
105
+ it { should be_instance_of RS::TransportType }
105
106
  its(:id) { should_not be_nil }
106
107
  its(:name) { should_not be_nil }
107
108
  its(:name) { should_not be_empty }
data/spec/rs/sys_spec.rb CHANGED
@@ -1,5 +1,6 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  require 'spec_helper'
3
+ require 'rs'
3
4
 
4
5
  IP_PATTERN = /^[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}.[0-9]{1,3}$/
5
6
 
@@ -33,7 +34,7 @@ describe 'check service user' do
33
34
  @user = RS.check_service_user(RS.su_params)
34
35
  end
35
36
  subject { @user }
36
- it { should be_instance_of User }
37
+ it { should be_instance_of RS::User }
37
38
  its(:id) { should_not be_nil }
38
39
  its(:payer_id) { should_not be_nil }
39
40
  its(:user_name) { should_not be_nil }
@@ -1,11 +1,12 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  require 'spec_helper'
3
+ require 'rs'
3
4
 
4
5
  def waybill_skeleton(params = {})
5
6
  waybill = RS::Waybill.new
6
7
  waybill.id = params[:id]
7
8
  waybill.type = params[:type] ? params[:type] : RS::WaybillType::TRANSPORTATION
8
- waybill.status = params[:status] ? params[:status] : RS::Waybill::STATUS_START
9
+ waybill.status = params[:status] ? params[:status] : RS::Waybill::STATUS_SAVED
9
10
  waybill.seller_id = params[:seller_id] ? params[:seller_id] : 731937
10
11
  waybill.buyer_tin = params[:buyer_tin] ? params[:buyer_tin] : '12345678910'
11
12
  waybill.check_buyer_tin = params[:check_buyer_tin] ? params[:check_buyer_tin] : true
@@ -27,7 +28,7 @@ def waybill_skeleton(params = {})
27
28
  if params[:items]
28
29
  items = []
29
30
  params[:items].each do |item|
30
- item = WaybillItem.new
31
+ item = RS::WaybillItem.new
31
32
  item.prod_name = item[:name]
32
33
  item.unit_id = item[:unit_id]
33
34
  item.unit_name = item[:unit_name]
@@ -37,7 +38,7 @@ def waybill_skeleton(params = {})
37
38
  items << item
38
39
  end
39
40
  else
40
- item = WaybillItem.new
41
+ item = RS::WaybillItem.new
41
42
  item.prod_name = 'სატესტო საქონელი'
42
43
  item.unit_id = 99
43
44
  item.unit_name = 'ერთეული'
data/spec/spec_helper.rb CHANGED
@@ -24,10 +24,6 @@ RSpec.configure do |config|
24
24
  config.include(RSpec::Matchers)
25
25
  end
26
26
 
27
- # RS namespace is included by default
28
-
29
- include RS
30
-
31
27
  # Test organizations provided by RS.GE service
32
28
 
33
29
  module RS
@@ -39,10 +35,10 @@ module RS
39
35
  SU_NAME = 'dimitri1979'
40
36
  SU_PSWD = '123456'
41
37
  end
42
- def su_params
38
+ def self.su_params
43
39
  {'su' => SU_NAME, 'sp' => SU_PSWD}
44
40
  end
45
- def auth_params(org = 1)
41
+ def self.auth_params(org = 1)
46
42
  u = org == 1 ? TEST_ORG1[:user] : TEST_ORG2[:user]
47
43
  p = org == 2 ? TEST_ORG1[:password] : TEST_ORG2[:password]
48
44
  {'user_name' => u, 'user_password' => p}
data/test.rb CHANGED
@@ -100,7 +100,7 @@ end
100
100
  class Waybill
101
101
  TRANSPORTATION_PAID_BY_BUYER = 1
102
102
  TRANSPORTATION_PAID_BY_SELLER = 2
103
- STATUS_START = 0
103
+ STATUS_SAVED = 0
104
104
  STATUS_ACTIVE = 1
105
105
  attr_accessor :id, :type, :status, :parent_id
106
106
  attr_accessor :seller_id # გამყიდველის უნიკალური კოდი
@@ -149,7 +149,7 @@ end
149
149
 
150
150
  waybill = Waybill.new
151
151
  waybill.type = 2
152
- waybill.status = Waybill::STATUS_START
152
+ waybill.status = Waybill::STATUS_SAVED
153
153
  waybill.seller_id = 731937
154
154
  waybill.buyer_tin = '12345678910'
155
155
  waybill.check_buyer_tin = true
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rs.ge
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-02-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &70280107131400 !ruby/object:Gem::Requirement
16
+ requirement: &70273400862040 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '2'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70280107131400
24
+ version_requirements: *70273400862040
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: simplecov
27
- requirement: &70280110621160 !ruby/object:Gem::Requirement
27
+ requirement: &70273400861640 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: '0'
33
33
  type: :development
34
34
  prerelease: false
35
- version_requirements: *70280110621160
35
+ version_requirements: *70273400861640
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: savon
38
- requirement: &70280110618940 !ruby/object:Gem::Requirement
38
+ requirement: &70273400861180 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *70280110618940
46
+ version_requirements: *70273400861180
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: httpi
49
- requirement: &70280110617040 !ruby/object:Gem::Requirement
49
+ requirement: &70273400860760 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,7 +54,7 @@ dependencies:
54
54
  version: '0'
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *70280110617040
57
+ version_requirements: *70273400860760
58
58
  description: ruby client for rs.ge web services
59
59
  email:
60
60
  - dimitri@c12.ge