cropio-ruby 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 25080162e2321540d9afef974e98a51a4c47dc05
4
- data.tar.gz: b855bcb0aa6ff3dc79d3f736d9da56646efc2ae1
3
+ metadata.gz: 322d909d3d7088aa3a9f449a6d489142636d5ec0
4
+ data.tar.gz: 7fd7bba2137009c7d2ed9f82cde8346d59830a2c
5
5
  SHA512:
6
- metadata.gz: f70244336a238b35fcbdb552edbcf5f962de80d91aafbdb64a673f8abc39f748b8212242f372e0d331a5633e24d4d2b0bb2a0db617d1b6bb703eb349c10abac1
7
- data.tar.gz: 8bc77ab8e26b55f5a4bb222db8e475ddc7a6bd2424f44fa9c6d50087ded61f1cfce89cf9075c5700d7404bdaec072870edfe3e51d7e87b188b95a09214bffa91
6
+ metadata.gz: 29d24cff50057ca959cf9b734a7d35fcbff2eac4efd23b4a280419c7e63358cb6b8c69b96d9f70f220fd312be7fa28d33d056502b9c05270f467fa201fd8db5c
7
+ data.tar.gz: a706fb76658df9a2deec5edf46403df9ff1bd3c7b72f382587c4105d7d5fd1d630993cbdb4c33818ebad88d433d6ccac5ea2e430f544db013c9430c619022537
data/README.md CHANGED
@@ -21,7 +21,61 @@ Or install it yourself as:
21
21
 
22
22
  ## Usage
23
23
 
24
- You
24
+ Require it:
25
+
26
+ $ require 'cropio'
27
+
28
+ To load Cropio resources to current namespace:
29
+
30
+ ```ruby
31
+ include Cropio::Resources
32
+ ```
33
+
34
+ You need to specify your email and password. At first time when you'll
35
+ try to request some data from Cropio gem will get authentication token.
36
+
37
+ ```ruby
38
+ Cropio.credentials = {
39
+ email: 'your account email,
40
+ password: 'your password'
41
+ }
42
+
43
+ Crop.all
44
+
45
+ Cropio.credentials.api_token
46
+ => "authenticationToken"
47
+ ```
48
+
49
+ Currently supported API methods is:
50
+
51
+ - index
52
+
53
+ ```ruby
54
+ Crop.all
55
+ ```
56
+
57
+ - create
58
+
59
+ ```ruby
60
+ Crop.new(name: 'new crop').save
61
+ ```
62
+
63
+ - update
64
+
65
+ ```ruby
66
+ crop = Crop.all.last
67
+ crop.short_name = 'new'
68
+ crop.save
69
+
70
+ ```
71
+
72
+
73
+ - delete
74
+
75
+ ```ruby
76
+ crop = Crop.all.last
77
+ crop.destroy
78
+ ```
25
79
 
26
80
  ## Development
27
81
 
@@ -46,6 +46,16 @@ module Cropio
46
46
  end
47
47
  end
48
48
 
49
+ def destroy?
50
+ if persisted?
51
+ Proxy.delete("#{resources_name}/#{id}")
52
+ @persisted = false
53
+ true
54
+ else
55
+ raise 'Cropio record is not persisted!'
56
+ end
57
+ end
58
+
49
59
  private
50
60
  def resources_name
51
61
  self.class.resources_name
@@ -1,3 +1,3 @@
1
1
  module Cropio
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cropio-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sergey Vernidub