jsender 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +49 -1
- data/lib/jsender/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e13bd362c7cce69c241a3a1446528392474d7a80
|
4
|
+
data.tar.gz: 504901bd1605a457aa7024450df95a90dd689d9d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 915f383ac9d8a6376d08593d62ef4c98fd8748bc9d20c0f4960691b74b2cdc134dbf42f9a8afeeec15a614946886ad4af1e92ae8f8030421f55cc107369d1a4a
|
7
|
+
data.tar.gz: 076433744e0a3135623ea77ef34b9f9d6723b03ab8eb4e40204af74dcfdf39141dd8ca808a2b5988866f9b233a9cea98ea3e528ed85492f693ea612a58b4b88c
|
data/README.md
CHANGED
@@ -20,6 +20,54 @@ Or install it yourself as:
|
|
20
20
|
|
21
21
|
## Usage
|
22
22
|
|
23
|
+
```
|
24
|
+
require 'jsender'
|
25
|
+
|
26
|
+
class CodeClass
|
27
|
+
include Jsender
|
28
|
+
|
29
|
+
def action(code)
|
30
|
+
return success if code == 1
|
31
|
+
return success('code 2 selected') if code == 2
|
32
|
+
return success_data({ 'a' => 'A', 'b' => 'B' }) if code == 3
|
33
|
+
return success('some data for you', ['d', 'a', 't', 'a']) if code == 4
|
34
|
+
return fail('code 5 selected') if code == 5
|
35
|
+
return fail_data({ 'a' => 'A', 'b' => 'B' }) if code == 6
|
36
|
+
return fail('some errors for you', ['d', 'a', 't', 'a']) if code == 7
|
37
|
+
fail
|
38
|
+
end
|
39
|
+
end
|
40
|
+
```
|
41
|
+
|
42
|
+
```
|
43
|
+
iut = CodeClass.new
|
44
|
+
```
|
45
|
+
|
46
|
+
```
|
47
|
+
iut.action(1)
|
48
|
+
=> {"status"=>"success", "data"=>{"result"=>nil, "notifications"=>["success"]}}
|
49
|
+
|
50
|
+
iut.action(2)
|
51
|
+
=> {"status"=>"success", "data"=>{"result"=>nil, "notifications"=>["code 2 selected"]}}
|
52
|
+
|
53
|
+
iut.action(3)
|
54
|
+
=> {"status"=>"success", "data"=>{"a"=>"A", "b"=>"B", "notifications"=>["success"]}}
|
55
|
+
|
56
|
+
iut.action(4)
|
57
|
+
=> {"status"=>"success", "data"=>{"result"=>["d", "a", "t", "a"], "notifications"=>["some data for you"]}}
|
58
|
+
|
59
|
+
iut.action(5)
|
60
|
+
=> {"status"=>"fail", "data"=>{"result"=>nil, "notifications"=>["code 5 selected"]}}
|
61
|
+
|
62
|
+
iut.action(6)
|
63
|
+
=> {"status"=>"fail", "data"=>{"a"=>"A", "b"=>"B", "notifications"=>["fail"]}}
|
64
|
+
|
65
|
+
iut.action(7)
|
66
|
+
=> {"status"=>"fail", "data"=>{"result"=>["d", "a", "t", "a"], "notifications"=>["some errors for you"]}}
|
67
|
+
|
68
|
+
iut.action(0)
|
69
|
+
=> {"status"=>"fail", "data"=>{"result"=>nil, "notifications"=>["fail"]}}
|
70
|
+
```
|
23
71
|
|
24
72
|
## Development
|
25
73
|
|
@@ -29,7 +77,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
29
77
|
|
30
78
|
## Contributing
|
31
79
|
|
32
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
80
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/hetznerZA/jsender. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](contributor-covenant.org) code of conduct.
|
33
81
|
|
34
82
|
|
35
83
|
## License
|
data/lib/jsender/version.rb
CHANGED