rs.ge 0.1.0.rc1 → 0.1.0.rc2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,6 +1,28 @@
1
1
  # RS.GE web services
2
2
 
3
- This is a tiny API for working with [rs.ge](http://eservices.rs.ge) web-services from Ruby.
3
+ This is a tiny API for working with [rs.ge](http://eservices.rs.ge) web-services in Ruby.
4
+
5
+ ## Configuration
6
+
7
+ Configuration is done using `RS.config` object.
8
+ You can predefine `su` and `sp` parameters (*service user* name and password),
9
+ which are required in almost every API call for authentication:
10
+
11
+ ```ruby
12
+ # configure service
13
+ RS.config.su = 'my_service_username'
14
+ RS.config.sp = 'my_service_password'
15
+ ```
16
+
17
+ There is one more option, which can be used for configuration. Namely, `validate_remote` flag,
18
+ which indicates if TIN numbers are validated remotely when a waybill is validated.
19
+
20
+ ```ruby
21
+ # validate remotes (the default is false)
22
+ RS.config.validate_remote = true
23
+ ```
24
+
25
+ It's recommended to have this flag on `true`, unless performance considerations require the oposite.
4
26
 
5
27
  ## System methods
6
28
 
@@ -18,7 +40,7 @@ Before you can work with main API functions, you need to create a special user
18
40
  created = RS.sys.create_user(username: 'your_rs.ge_username', password: 'secret', ip: 'access_ip', name: 'name_of_this_user/ip_pair', su: 'new_user', sp: 'new_password'))
19
41
  ```
20
42
 
21
- All parameters in the example above are required. The method return `true` if the user creation was successfull.
43
+ All parameters in the example above are required. The method returns `true` if the user creation was successfull.
22
44
 
23
45
  When you need to update your user (including password change), `update_user` method should be used:
24
46
 
@@ -40,4 +62,33 @@ If the username/passowrd pair is correct, the following hash is returned:
40
62
 
41
63
  where `payer` is the unique ID of the payer, whom this user belongs to, and `user` gives ID of the user itself.
42
64
 
43
- Payer ID is very important for futher processing.
65
+ ## Dictionary Calls
66
+
67
+ You can get *units* using `units` method on dictionary object:
68
+
69
+ ```ruby
70
+ units = RS.dict.units(su: su, sp: sp) # => returns {id: name} hash of units
71
+ ```
72
+
73
+ *Transport* and *waybill types* can be obtained in the same way:
74
+
75
+ ```ruby
76
+ transport_types = RS.dict.transport_types(su: su, sp: sp) # => {id: name}
77
+ waybill_types = RS.dict.waybill_types(su: su, sp: sp) # => {id: name}
78
+ ```
79
+
80
+ It should be noted, that transport and waybill types can be obtained without calling
81
+ those remote method, by simply taking `RS::TRANSPORT_TYPES` and `RS::WAYBILL_TYPES`
82
+ constants. This constants represent the current (relativly unchanged) set of
83
+ transport and waybill types and may be changed by Revenue Service in the future.
84
+ We'll try to update them accordingly, but there is no guarantee on exact match.
85
+
86
+ The last method of `RS.dict` method is usefull for obtaining name of the
87
+ person/organization by its TIN-number:
88
+
89
+ ```ruby
90
+ name = RS.dict.get_name_from_tin(tin: '02001000490') # => 'დიმიტრი ყურაშვილი'
91
+ ```
92
+
93
+ > Note, that we didn't used `su` and `sp` parameters in the last method call,
94
+ > while we suppose they were predefined in `RS.config` object (see configuration section).
data/lib/rs/version.rb CHANGED
@@ -1,4 +1,4 @@
1
1
  # -*- encoding : utf-8 -*-
2
2
  module RS
3
- VERSION = '0.1.0.rc1'
3
+ VERSION = '0.1.0.rc2'
4
4
  end
data/rs.gemspec CHANGED
@@ -19,8 +19,7 @@ Gem::Specification.new do |s|
19
19
  s.require_paths = ["lib"]
20
20
 
21
21
  s.add_development_dependency 'rspec', '~> 2'
22
- s.add_runtime_dependency 'savon', '0.9.9'
23
- s.add_runtime_dependency 'httpi'
22
+ s.add_runtime_dependency 'savon', '~> 1.0'
24
23
  s.add_runtime_dependency 'prawn', '~>0.12'
25
24
  s.add_runtime_dependency 'c12-commons', '~> 0.0.5'
26
25
  end
data/spec/spec_helper.rb CHANGED
@@ -5,7 +5,9 @@
5
5
  require 'savon'
6
6
 
7
7
  HTTPI.log = false
8
- Savon.log = false
8
+ Savon.configure do |config|
9
+ config.log = false
10
+ end
9
11
 
10
12
  # RSpec
11
13
 
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.1.0.rc1
4
+ version: 0.1.0.rc2
5
5
  prerelease: 6
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-06-11 00:00:00.000000000 Z
12
+ date: 2012-06-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
@@ -32,33 +32,17 @@ dependencies:
32
32
  requirement: !ruby/object:Gem::Requirement
33
33
  none: false
34
34
  requirements:
35
- - - '='
36
- - !ruby/object:Gem::Version
37
- version: 0.9.9
38
- type: :runtime
39
- prerelease: false
40
- version_requirements: !ruby/object:Gem::Requirement
41
- none: false
42
- requirements:
43
- - - '='
44
- - !ruby/object:Gem::Version
45
- version: 0.9.9
46
- - !ruby/object:Gem::Dependency
47
- name: httpi
48
- requirement: !ruby/object:Gem::Requirement
49
- none: false
50
- requirements:
51
- - - ! '>='
35
+ - - ~>
52
36
  - !ruby/object:Gem::Version
53
- version: '0'
37
+ version: '1.0'
54
38
  type: :runtime
55
39
  prerelease: false
56
40
  version_requirements: !ruby/object:Gem::Requirement
57
41
  none: false
58
42
  requirements:
59
- - - ! '>='
43
+ - - ~>
60
44
  - !ruby/object:Gem::Version
61
- version: '0'
45
+ version: '1.0'
62
46
  - !ruby/object:Gem::Dependency
63
47
  name: prawn
64
48
  requirement: !ruby/object:Gem::Requirement
@@ -140,7 +124,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
140
124
  version: 1.3.1
141
125
  requirements: []
142
126
  rubyforge_project: rs
143
- rubygems_version: 1.8.24
127
+ rubygems_version: 1.8.23
144
128
  signing_key:
145
129
  specification_version: 3
146
130
  summary: rs.ge web services