likeno 0.0.1.rc → 0.0.1.rc2

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: 7ef9a80e1d55bc4f8beff12ce4374c3d82b504a8
4
- data.tar.gz: ba88b1423ef0bf7d3bb3c500ff3a1719fa553dfc
3
+ metadata.gz: 5999e30bddb7d9b3ca7fe9d4a989c90fb3d1624d
4
+ data.tar.gz: 8f312491efd8109ed0f35c8b6d74f546c5f8de33
5
5
  SHA512:
6
- metadata.gz: 8eddd05258a3aa3cb471167e702363acaabf4db0040951678ac1f2a17acd239bdf8834b0eb40327ae09cfa6674c4a0cb133037d1331b4d5cc8780e8452c06e3b
7
- data.tar.gz: 2ffa02133f413f5286a695dd9c93057ef750a9fa0da9ab57b3a8c7adeef37f2c97da7e63cb145ae3d47bbed480302fb5ef0be45192dd550713f1bd28d3395c99
6
+ metadata.gz: 58c18f82717d45eeaa2b4e22842da8d8a7f9b22c8b5a41c38386afc1debe4f49c59dd433bb11a4185ec8a3358864d68cb59490fc1b140e97f9bc022e6a15ae70
7
+ data.tar.gz: 9aede81973991cb206ba085c5802d5d04aed21c0d922fbb8ac0cda98fbb8a233ccc68e9c7ec85cdeae2679c89c3fef61158340164d3677dea2d34ef65e62c0b2
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.2.3
1
+ 2.3.0
data/.travis.yml CHANGED
@@ -1,4 +1,4 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.2.3
3
+ - 2.3.0
4
4
  before_install: gem install bundler -v 1.10.6
data/CHANGELOG.rdoc ADDED
@@ -0,0 +1,19 @@
1
+ = Revision history for the Likeno gem
2
+
3
+ Likeno is a library for remote data model access over HTTP
4
+
5
+ == v0.0.1 (Initial version)
6
+
7
+ Imported from KalibroClient (http://github.com/mezuro/kalibro_client)
8
+
9
+ Features:
10
+
11
+ * Data model access over HTTP
12
+ * Entity creation with POST
13
+ * Entity updates with POST
14
+ * Entity retrieval with GET
15
+ * Entity deletion with DELETE
16
+ * Methods for reading/writing to and from JSON and JSON arrays
17
+ * Basic validation and error accumulation support
18
+ * Handling of basic HTTP errors with corresponding exceptions (in the errors module)
19
+ * Helpers for date conversions and parameter generations
data/LICENSE ADDED
@@ -0,0 +1,165 @@
1
+ GNU LESSER GENERAL PUBLIC LICENSE
2
+ Version 3, 29 June 2007
3
+
4
+ Copyright (C) 2007 Free Software Foundation, Inc. <http://fsf.org/>
5
+ Everyone is permitted to copy and distribute verbatim copies
6
+ of this license document, but changing it is not allowed.
7
+
8
+
9
+ This version of the GNU Lesser General Public License incorporates
10
+ the terms and conditions of version 3 of the GNU General Public
11
+ License, supplemented by the additional permissions listed below.
12
+
13
+ 0. Additional Definitions.
14
+
15
+ As used herein, "this License" refers to version 3 of the GNU Lesser
16
+ General Public License, and the "GNU GPL" refers to version 3 of the GNU
17
+ General Public License.
18
+
19
+ "The Library" refers to a covered work governed by this License,
20
+ other than an Application or a Combined Work as defined below.
21
+
22
+ An "Application" is any work that makes use of an interface provided
23
+ by the Library, but which is not otherwise based on the Library.
24
+ Defining a subclass of a class defined by the Library is deemed a mode
25
+ of using an interface provided by the Library.
26
+
27
+ A "Combined Work" is a work produced by combining or linking an
28
+ Application with the Library. The particular version of the Library
29
+ with which the Combined Work was made is also called the "Linked
30
+ Version".
31
+
32
+ The "Minimal Corresponding Source" for a Combined Work means the
33
+ Corresponding Source for the Combined Work, excluding any source code
34
+ for portions of the Combined Work that, considered in isolation, are
35
+ based on the Application, and not on the Linked Version.
36
+
37
+ The "Corresponding Application Code" for a Combined Work means the
38
+ object code and/or source code for the Application, including any data
39
+ and utility programs needed for reproducing the Combined Work from the
40
+ Application, but excluding the System Libraries of the Combined Work.
41
+
42
+ 1. Exception to Section 3 of the GNU GPL.
43
+
44
+ You may convey a covered work under sections 3 and 4 of this License
45
+ without being bound by section 3 of the GNU GPL.
46
+
47
+ 2. Conveying Modified Versions.
48
+
49
+ If you modify a copy of the Library, and, in your modifications, a
50
+ facility refers to a function or data to be supplied by an Application
51
+ that uses the facility (other than as an argument passed when the
52
+ facility is invoked), then you may convey a copy of the modified
53
+ version:
54
+
55
+ a) under this License, provided that you make a good faith effort to
56
+ ensure that, in the event an Application does not supply the
57
+ function or data, the facility still operates, and performs
58
+ whatever part of its purpose remains meaningful, or
59
+
60
+ b) under the GNU GPL, with none of the additional permissions of
61
+ this License applicable to that copy.
62
+
63
+ 3. Object Code Incorporating Material from Library Header Files.
64
+
65
+ The object code form of an Application may incorporate material from
66
+ a header file that is part of the Library. You may convey such object
67
+ code under terms of your choice, provided that, if the incorporated
68
+ material is not limited to numerical parameters, data structure
69
+ layouts and accessors, or small macros, inline functions and templates
70
+ (ten or fewer lines in length), you do both of the following:
71
+
72
+ a) Give prominent notice with each copy of the object code that the
73
+ Library is used in it and that the Library and its use are
74
+ covered by this License.
75
+
76
+ b) Accompany the object code with a copy of the GNU GPL and this license
77
+ document.
78
+
79
+ 4. Combined Works.
80
+
81
+ You may convey a Combined Work under terms of your choice that,
82
+ taken together, effectively do not restrict modification of the
83
+ portions of the Library contained in the Combined Work and reverse
84
+ engineering for debugging such modifications, if you also do each of
85
+ the following:
86
+
87
+ a) Give prominent notice with each copy of the Combined Work that
88
+ the Library is used in it and that the Library and its use are
89
+ covered by this License.
90
+
91
+ b) Accompany the Combined Work with a copy of the GNU GPL and this license
92
+ document.
93
+
94
+ c) For a Combined Work that displays copyright notices during
95
+ execution, include the copyright notice for the Library among
96
+ these notices, as well as a reference directing the user to the
97
+ copies of the GNU GPL and this license document.
98
+
99
+ d) Do one of the following:
100
+
101
+ 0) Convey the Minimal Corresponding Source under the terms of this
102
+ License, and the Corresponding Application Code in a form
103
+ suitable for, and under terms that permit, the user to
104
+ recombine or relink the Application with a modified version of
105
+ the Linked Version to produce a modified Combined Work, in the
106
+ manner specified by section 6 of the GNU GPL for conveying
107
+ Corresponding Source.
108
+
109
+ 1) Use a suitable shared library mechanism for linking with the
110
+ Library. A suitable mechanism is one that (a) uses at run time
111
+ a copy of the Library already present on the user's computer
112
+ system, and (b) will operate properly with a modified version
113
+ of the Library that is interface-compatible with the Linked
114
+ Version.
115
+
116
+ e) Provide Installation Information, but only if you would otherwise
117
+ be required to provide such information under section 6 of the
118
+ GNU GPL, and only to the extent that such information is
119
+ necessary to install and execute a modified version of the
120
+ Combined Work produced by recombining or relinking the
121
+ Application with a modified version of the Linked Version. (If
122
+ you use option 4d0, the Installation Information must accompany
123
+ the Minimal Corresponding Source and Corresponding Application
124
+ Code. If you use option 4d1, you must provide the Installation
125
+ Information in the manner specified by section 6 of the GNU GPL
126
+ for conveying Corresponding Source.)
127
+
128
+ 5. Combined Libraries.
129
+
130
+ You may place library facilities that are a work based on the
131
+ Library side by side in a single library together with other library
132
+ facilities that are not Applications and are not covered by this
133
+ License, and convey such a combined library under terms of your
134
+ choice, if you do both of the following:
135
+
136
+ a) Accompany the combined library with a copy of the same work based
137
+ on the Library, uncombined with any other library facilities,
138
+ conveyed under the terms of this License.
139
+
140
+ b) Give prominent notice with the combined library that part of it
141
+ is a work based on the Library, and explaining where to find the
142
+ accompanying uncombined form of the same work.
143
+
144
+ 6. Revised Versions of the GNU Lesser General Public License.
145
+
146
+ The Free Software Foundation may publish revised and/or new versions
147
+ of the GNU Lesser General Public License from time to time. Such new
148
+ versions will be similar in spirit to the present version, but may
149
+ differ in detail to address new problems or concerns.
150
+
151
+ Each version is given a distinguishing version number. If the
152
+ Library as you received it specifies that a certain numbered version
153
+ of the GNU Lesser General Public License "or any later version"
154
+ applies to it, you have the option of following the terms and
155
+ conditions either of that published version or of any later version
156
+ published by the Free Software Foundation. If the Library as you
157
+ received it does not specify a version number of the GNU Lesser
158
+ General Public License, you may choose any version of the GNU Lesser
159
+ General Public License ever published by the Free Software Foundation.
160
+
161
+ If the Library as you received it specifies that a proxy can decide
162
+ whether future versions of the GNU Lesser General Public License shall
163
+ apply, that proxy's public statement of acceptance of any version is
164
+ permanent authorization for you to choose that version for the
165
+ Library.
data/lib/likeno/entity.rb CHANGED
@@ -1,9 +1,23 @@
1
+ # This file is part of Likeno. Copyright (C) 2013-2016 The Mezuro Team
2
+
3
+ # Likeno is free software: you can redistribute it and/or modify
4
+ # it under the terms of the GNU Lesser General Public License as published by
5
+ # the Free Software Foundation, either version 3 of the License, or
6
+ # (at your option) any later version.
7
+
8
+ # Likeno is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU Lesser General Public License for more details.
12
+
13
+ # You should have received a copy of the GNU Lesser General Public License
14
+ # along with Likeno. If not, see <http://www.gnu.org/licenses/>.
15
+
1
16
  require 'active_support/inflector'
2
- require 'faraday_middleware'
3
- require 'errors'
4
- require 'helpers/hash_converters'
5
- require 'helpers/crud_request_parameters'
6
17
  require 'likeno/request_methods'
18
+ require 'likeno/helpers/hash_converters'
19
+ require 'likeno/helpers/crud_request_parameters'
20
+ require 'likeno/errors'
7
21
 
8
22
  module Likeno
9
23
  class Entity
@@ -0,0 +1,34 @@
1
+ # This file is part of Likeno. Copyright (C) 2013-2016 The Mezuro Team
2
+
3
+ # Likeno is free software: you can redistribute it and/or modify
4
+ # it under the terms of the GNU Lesser General Public License as published by
5
+ # the Free Software Foundation, either version 3 of the License, or
6
+ # (at your option) any later version.
7
+
8
+ # Likeno is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU Lesser General Public License for more details.
12
+
13
+ # You should have received a copy of the GNU Lesser General Public License
14
+ # along with Likeno. If not, see <http://www.gnu.org/licenses/>.
15
+
16
+ module Likeno
17
+ module Errors
18
+ class RecordInvalid < Standard
19
+ attr_reader :record
20
+
21
+ def initialize(record = nil)
22
+ if record
23
+ @record = record
24
+ errors = @record.likeno_errors.join(', ')
25
+ message = "Record invalid: #{errors}"
26
+ else
27
+ message = 'Record invalid'
28
+ end
29
+
30
+ super(message)
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,21 @@
1
+ # This file is part of Likeno. Copyright (C) 2013-2016 The Mezuro Team
2
+
3
+ # Likeno is free software: you can redistribute it and/or modify
4
+ # it under the terms of the GNU Lesser General Public License as published by
5
+ # the Free Software Foundation, either version 3 of the License, or
6
+ # (at your option) any later version.
7
+
8
+ # Likeno is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU Lesser General Public License for more details.
12
+
13
+ # You should have received a copy of the GNU Lesser General Public License
14
+ # along with Likeno. If not, see <http://www.gnu.org/licenses/>.
15
+
16
+ module Likeno
17
+ module Errors
18
+ class RecordNotFound < RequestError
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,26 @@
1
+ # This file is part of Likeno. Copyright (C) 2013-2016 The Mezuro Team
2
+
3
+ # Likeno is free software: you can redistribute it and/or modify
4
+ # it under the terms of the GNU Lesser General Public License as published by
5
+ # the Free Software Foundation, either version 3 of the License, or
6
+ # (at your option) any later version.
7
+
8
+ # Likeno is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU Lesser General Public License for more details.
12
+
13
+ # You should have received a copy of the GNU Lesser General Public License
14
+ # along with Likeno. If not, see <http://www.gnu.org/licenses/>.
15
+
16
+ module Likeno
17
+ module Errors
18
+ class RequestError < Standard
19
+ attr_reader :response
20
+
21
+ def initialize(attributes = {})
22
+ @response = attributes[:response]
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,21 @@
1
+ # This file is part of Likeno. Copyright (C) 2013-2016 The Mezuro Team
2
+
3
+ # Likeno is free software: you can redistribute it and/or modify
4
+ # it under the terms of the GNU Lesser General Public License as published by
5
+ # the Free Software Foundation, either version 3 of the License, or
6
+ # (at your option) any later version.
7
+
8
+ # Likeno is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU Lesser General Public License for more details.
12
+
13
+ # You should have received a copy of the GNU Lesser General Public License
14
+ # along with Likeno. If not, see <http://www.gnu.org/licenses/>.
15
+
16
+ module Likeno
17
+ module Errors
18
+ class Standard < StandardError
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,19 @@
1
+ # This file is part of Likeno. Copyright (C) 2013-2016 The Mezuro Team
2
+
3
+ # Likeno is free software: you can redistribute it and/or modify
4
+ # it under the terms of the GNU Lesser General Public License as published by
5
+ # the Free Software Foundation, either version 3 of the License, or
6
+ # (at your option) any later version.
7
+
8
+ # Likeno is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU Lesser General Public License for more details.
12
+
13
+ # You should have received a copy of the GNU Lesser General Public License
14
+ # along with Likeno. If not, see <http://www.gnu.org/licenses/>.
15
+
16
+ require 'likeno/errors/standard'
17
+ require 'likeno/errors/request_error'
18
+ require 'likeno/errors/record_not_found'
19
+ require 'likeno/errors/record_invalid'
@@ -0,0 +1,65 @@
1
+ # This file is part of Likeno. Copyright (C) 2013-2016 The Mezuro Team
2
+
3
+ # Likeno is free software: you can redistribute it and/or modify
4
+ # it under the terms of the GNU Lesser General Public License as published by
5
+ # the Free Software Foundation, either version 3 of the License, or
6
+ # (at your option) any later version.
7
+
8
+ # Likeno is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU Lesser General Public License for more details.
12
+
13
+ # You should have received a copy of the GNU Lesser General Public License
14
+ # along with Likeno. If not, see <http://www.gnu.org/licenses/>.
15
+
16
+ module Likeno
17
+ module CRUDRequestParameters
18
+ def save_params
19
+ { instance_entity_name.underscore.to_sym => to_hash }
20
+ end
21
+
22
+ def save_action
23
+ ''
24
+ end
25
+
26
+ def save_prefix
27
+ ''
28
+ end
29
+
30
+ def destroy_action
31
+ ':id'
32
+ end
33
+ alias_method :update_action, :destroy_action
34
+
35
+ def destroy_params
36
+ { id: id }
37
+ end
38
+
39
+ def destroy_prefix
40
+ ''
41
+ end
42
+
43
+ def update_params
44
+ { instance_entity_name.underscore.to_sym => to_hash, :id => id }
45
+ end
46
+
47
+ def update_prefix
48
+ ''
49
+ end
50
+
51
+ module ClassMethods
52
+ def exists_action
53
+ ':id/exists'
54
+ end
55
+
56
+ def id_params(id)
57
+ { id: id }
58
+ end
59
+
60
+ def find_action
61
+ ':id'
62
+ end
63
+ end
64
+ end
65
+ end
@@ -0,0 +1,30 @@
1
+ # This file is part of Likeno. Copyright (C) 2013-2016 The Mezuro Team
2
+
3
+ # Likeno is free software: you can redistribute it and/or modify
4
+ # it under the terms of the GNU Lesser General Public License as published by
5
+ # the Free Software Foundation, either version 3 of the License, or
6
+ # (at your option) any later version.
7
+
8
+ # Likeno is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU Lesser General Public License for more details.
12
+
13
+ # You should have received a copy of the GNU Lesser General Public License
14
+ # along with Likeno. If not, see <http://www.gnu.org/licenses/>.
15
+
16
+ require 'date'
17
+
18
+ module Likeno
19
+ module DateAttributes
20
+ attr_reader :created_at, :updated_at
21
+
22
+ def created_at=(value)
23
+ @created_at = DateTime.parse(value)
24
+ end
25
+
26
+ def updated_at=(value)
27
+ @updated_at = DateTime.parse(value)
28
+ end
29
+ end
30
+ end
@@ -0,0 +1,42 @@
1
+ # This file is part of Likeno. Copyright (C) 2013-2016 The Mezuro Team
2
+
3
+ # Likeno is free software: you can redistribute it and/or modify
4
+ # it under the terms of the GNU Lesser General Public License as published by
5
+ # the Free Software Foundation, either version 3 of the License, or
6
+ # (at your option) any later version.
7
+
8
+ # Likeno is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU Lesser General Public License for more details.
12
+
13
+ # You should have received a copy of the GNU Lesser General Public License
14
+ # along with Likeno. If not, see <http://www.gnu.org/licenses/>.
15
+
16
+ require 'date'
17
+
18
+ module Likeno
19
+ module HashConverters
20
+ def date_time_to_s(date)
21
+ milliseconds = '.' + (date.sec_fraction * 60 * 60 * 24 * 1000).to_s
22
+ date.to_s[0..18] + milliseconds + date.to_s[19..-1]
23
+ end
24
+
25
+ def convert_to_hash(value)
26
+ return value if value.nil?
27
+ return value.collect { |element| convert_to_hash(element) } if value.is_a? Array
28
+ return value.to_hash if value.is_a?(Likeno::Entity)
29
+ return date_time_to_s(value) if value.is_a? DateTime
30
+ return 'INF' if value.is_a?(Float) && value.infinite? == 1
31
+ return '-INF' if value.is_a?(Float) && value.infinite? == -1
32
+ value.to_s
33
+ end
34
+
35
+ def field_to_hash(field)
36
+ hash = {}
37
+ field_value = send(field)
38
+ hash[field] = convert_to_hash(field_value) unless field_value.nil?
39
+ hash
40
+ end
41
+ end
42
+ end
@@ -1,3 +1,22 @@
1
+ # This file is part of Likeno. Copyright (C) 2013-2016 The Mezuro Team
2
+
3
+ # Likeno is free software: you can redistribute it and/or modify
4
+ # it under the terms of the GNU Lesser General Public License as published by
5
+ # the Free Software Foundation, either version 3 of the License, or
6
+ # (at your option) any later version.
7
+
8
+ # Likeno is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU Lesser General Public License for more details.
12
+
13
+ # You should have received a copy of the GNU Lesser General Public License
14
+ # along with Likeno. If not, see <http://www.gnu.org/licenses/>.
15
+
16
+ require 'faraday'
17
+ require 'faraday_middleware'
18
+ require 'likeno/errors'
19
+
1
20
  module Likeno
2
21
  module RequestMethods
3
22
  def request(action, params = {}, method = :post, prefix = '')
@@ -1,3 +1,18 @@
1
+ # This file is part of Likeno. Copyright (C) 2013-2016 The Mezuro Team
2
+
3
+ # Likeno is free software: you can redistribute it and/or modify
4
+ # it under the terms of the GNU Lesser General Public License as published by
5
+ # the Free Software Foundation, either version 3 of the License, or
6
+ # (at your option) any later version.
7
+
8
+ # Likeno is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU Lesser General Public License for more details.
12
+
13
+ # You should have received a copy of the GNU Lesser General Public License
14
+ # along with Likeno. If not, see <http://www.gnu.org/licenses/>.
15
+
1
16
  module Likeno
2
- VERSION = '0.0.1.rc'
17
+ VERSION = '0.0.1.rc2'
3
18
  end
data/lib/likeno.rb CHANGED
@@ -1,3 +1,18 @@
1
+ # This file is part of Likeno. Copyright (C) 2013-2016 The Mezuro Team
2
+
3
+ # Likeno is free software: you can redistribute it and/or modify
4
+ # it under the terms of the GNU Lesser General Public License as published by
5
+ # the Free Software Foundation, either version 3 of the License, or
6
+ # (at your option) any later version.
7
+
8
+ # Likeno is distributed in the hope that it will be useful,
9
+ # but WITHOUT ANY WARRANTY; without even the implied warranty of
10
+ # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11
+ # GNU Lesser General Public License for more details.
12
+
13
+ # You should have received a copy of the GNU Lesser General Public License
14
+ # along with Likeno. If not, see <http://www.gnu.org/licenses/>.
15
+
1
16
  require 'yaml'
2
17
  require 'logger'
3
18
  require 'likeno/entity'
data/likeno.gemspec CHANGED
@@ -19,11 +19,12 @@ Gem::Specification.new do |spec|
19
19
  spec.require_paths = ['lib']
20
20
 
21
21
  spec.add_development_dependency 'bundler', '~> 1.10'
22
- spec.add_development_dependency 'rake', '~> 10.0'
22
+ spec.add_development_dependency 'rake', '~> 11.1'
23
23
  spec.add_development_dependency 'rspec'
24
24
  spec.add_development_dependency 'mocha'
25
25
  spec.add_development_dependency 'factory_girl', '~> 4.5.0'
26
26
  spec.add_development_dependency 'simplecov'
27
+ spec.add_development_dependency 'codeclimate-test-reporter'
27
28
 
28
29
  spec.add_dependency 'faraday_middleware'
29
30
  spec.add_dependency 'activesupport', '>= 2.2.1'
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: likeno
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1.rc
4
+ version: 0.0.1.rc2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Heitor Reis
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: exe
12
12
  cert_chain: []
13
- date: 2016-01-18 00:00:00.000000000 Z
13
+ date: 2016-03-16 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler
@@ -32,14 +32,14 @@ dependencies:
32
32
  requirements:
33
33
  - - "~>"
34
34
  - !ruby/object:Gem::Version
35
- version: '10.0'
35
+ version: '11.1'
36
36
  type: :development
37
37
  prerelease: false
38
38
  version_requirements: !ruby/object:Gem::Requirement
39
39
  requirements:
40
40
  - - "~>"
41
41
  - !ruby/object:Gem::Version
42
- version: '10.0'
42
+ version: '11.1'
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: rspec
45
45
  requirement: !ruby/object:Gem::Requirement
@@ -96,6 +96,20 @@ dependencies:
96
96
  - - ">="
97
97
  - !ruby/object:Gem::Version
98
98
  version: '0'
99
+ - !ruby/object:Gem::Dependency
100
+ name: codeclimate-test-reporter
101
+ requirement: !ruby/object:Gem::Requirement
102
+ requirements:
103
+ - - ">="
104
+ - !ruby/object:Gem::Version
105
+ version: '0'
106
+ type: :development
107
+ prerelease: false
108
+ version_requirements: !ruby/object:Gem::Requirement
109
+ requirements:
110
+ - - ">="
111
+ - !ruby/object:Gem::Version
112
+ version: '0'
99
113
  - !ruby/object:Gem::Dependency
100
114
  name: faraday_middleware
101
115
  requirement: !ruby/object:Gem::Requirement
@@ -136,23 +150,23 @@ files:
136
150
  - ".ruby-gemset"
137
151
  - ".ruby-version"
138
152
  - ".travis.yml"
153
+ - CHANGELOG.rdoc
139
154
  - Gemfile
155
+ - LICENSE
140
156
  - README.md
141
157
  - Rakefile
142
158
  - bin/console
143
159
  - bin/setup
144
- - lib/errors.rb
145
- - lib/errors/record_invalid.rb
146
- - lib/errors/record_not_found.rb
147
- - lib/errors/request_error.rb
148
- - lib/errors/standard.rb
149
- - lib/helpers/aggregation_options.rb
150
- - lib/helpers/crud_request_parameters.rb
151
- - lib/helpers/date_attributes.rb
152
- - lib/helpers/hash_converters.rb
153
- - lib/helpers/range_methods.rb
154
160
  - lib/likeno.rb
155
161
  - lib/likeno/entity.rb
162
+ - lib/likeno/errors.rb
163
+ - lib/likeno/errors/record_invalid.rb
164
+ - lib/likeno/errors/record_not_found.rb
165
+ - lib/likeno/errors/request_error.rb
166
+ - lib/likeno/errors/standard.rb
167
+ - lib/likeno/helpers/crud_request_parameters.rb
168
+ - lib/likeno/helpers/date_attributes.rb
169
+ - lib/likeno/helpers/hash_converters.rb
156
170
  - lib/likeno/request_methods.rb
157
171
  - lib/likeno/version.rb
158
172
  - likeno.gemspec
@@ -175,7 +189,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
175
189
  version: 1.3.1
176
190
  requirements: []
177
191
  rubyforge_project:
178
- rubygems_version: 2.4.8
192
+ rubygems_version: 2.5.1
179
193
  signing_key:
180
194
  specification_version: 4
181
195
  summary: Symbiotic connection between organisms
@@ -1,19 +0,0 @@
1
- module Likeno
2
- module Errors
3
- class RecordInvalid < Standard
4
- attr_reader :record
5
-
6
- def initialize(record = nil)
7
- if record
8
- @record = record
9
- errors = @record.likeno_errors.join(', ')
10
- message = "Record invalid: #{errors}"
11
- else
12
- message = 'Record invalid'
13
- end
14
-
15
- super(message)
16
- end
17
- end
18
- end
19
- end
@@ -1,6 +0,0 @@
1
- module Likeno
2
- module Errors
3
- class RecordNotFound < RequestError
4
- end
5
- end
6
- end
@@ -1,11 +0,0 @@
1
- module Likeno
2
- module Errors
3
- class RequestError < Standard
4
- attr_reader :response
5
-
6
- def initialize(attributes = {})
7
- @response = attributes[:response]
8
- end
9
- end
10
- end
11
- end
@@ -1,6 +0,0 @@
1
- module Likeno
2
- module Errors
3
- class Standard < StandardError
4
- end
5
- end
6
- end
data/lib/errors.rb DELETED
@@ -1,20 +0,0 @@
1
- # This file is part of KalibroClient
2
- # Copyright (C) 2013 it's respectives authors (please see the AUTHORS file)
3
- #
4
- # This program is free software: you can redistribute it and/or modify
5
- # it under the terms of the GNU General Public License as published by
6
- # the Free Software Foundation, either version 3 of the License, or
7
- # (at your option) any later version.
8
- #
9
- # This program is distributed in the hope that it will be useful,
10
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- # GNU General Public License for more details.
13
-
14
- # You should have received a copy of the GNU General Public License
15
- # along with this program. If not, see <http://www.gnu.org/licenses/>.
16
-
17
- require 'errors/standard'
18
- require 'errors/request_error'
19
- require 'errors/record_not_found'
20
- require 'errors/record_invalid'
@@ -1,25 +0,0 @@
1
- # This file is part of KalibroClient
2
- # Copyright (C) 2013 it's respectives authors (please see the AUTHORS file)
3
- #
4
- # This program is free software: you can redistribute it and/or modify
5
- # it under the terms of the GNU General Public License as published by
6
- # the Free Software Foundation, either version 3 of the License, or
7
- # (at your option) any later version.
8
- #
9
- # This program is distributed in the hope that it will be useful,
10
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- # GNU General Public License for more details.
13
-
14
- # You should have received a copy of the GNU General Public License
15
- # along with this program. If not, see <http://www.gnu.org/licenses/>.
16
-
17
- module AggregationOptions
18
- #TODO: internationalization
19
- def all_with_label
20
- [
21
- ["Mean","mean"], ["Median", "MEDIAN"], ["Maximum", "max"], ["Minimum", "min"],
22
- ["Count", "COUNT"], ["Standard Deviation", "STANDARD_DEVIATION"]
23
- ]
24
- end
25
- end
@@ -1,64 +0,0 @@
1
- # This file is part of KalibroClient
2
- # Copyright (C) 2013 it's respectives authors (please see the AUTHORS file)
3
- #
4
- # This program is free software: you can redistribute it and/or modify
5
- # it under the terms of the GNU General Public License as published by
6
- # the Free Software Foundation, either version 3 of the License, or
7
- # (at your option) any later version.
8
- #
9
- # This program is distributed in the hope that it will be useful,
10
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- # GNU General Public License for more details.
13
-
14
- # You should have received a copy of the GNU General Public License
15
- # along with this program. If not, see <http://www.gnu.org/licenses/>.
16
-
17
- module CRUDRequestParameters
18
- def save_params
19
- { instance_entity_name.underscore.to_sym => to_hash }
20
- end
21
-
22
- def save_action
23
- ''
24
- end
25
-
26
- def save_prefix
27
- ''
28
- end
29
-
30
- def destroy_action
31
- ':id'
32
- end
33
- alias_method :update_action, :destroy_action
34
-
35
- def destroy_params
36
- { id: id }
37
- end
38
-
39
- def destroy_prefix
40
- ''
41
- end
42
-
43
- def update_params
44
- { instance_entity_name.underscore.to_sym => to_hash, :id => id }
45
- end
46
-
47
- def update_prefix
48
- ''
49
- end
50
-
51
- module ClassMethods
52
- def exists_action
53
- ':id/exists'
54
- end
55
-
56
- def id_params(id)
57
- { id: id }
58
- end
59
-
60
- def find_action
61
- ':id'
62
- end
63
- end
64
- end
@@ -1,11 +0,0 @@
1
- module DateAttributes
2
- attr_reader :created_at, :updated_at
3
-
4
- def created_at=(value)
5
- @created_at = DateTime.parse(value)
6
- end
7
-
8
- def updated_at=(value)
9
- @updated_at = DateTime.parse(value)
10
- end
11
- end
@@ -1,25 +0,0 @@
1
- require 'date'
2
-
3
- module HashConverters
4
- def date_time_to_s(date)
5
- milliseconds = '.' + (date.sec_fraction * 60 * 60 * 24 * 1000).to_s
6
- date.to_s[0..18] + milliseconds + date.to_s[19..-1]
7
- end
8
-
9
- def convert_to_hash(value)
10
- return value if value.nil?
11
- return value.collect { |element| convert_to_hash(element) } if value.is_a? Array
12
- return value.to_hash if value.is_a?(Likeno::Entity)
13
- return date_time_to_s(value) if value.is_a? DateTime
14
- return 'INF' if value.is_a?(Float) && value.infinite? == 1
15
- return '-INF' if value.is_a?(Float) && value.infinite? == -1
16
- value.to_s
17
- end
18
-
19
- def field_to_hash(field)
20
- hash = {}
21
- field_value = send(field)
22
- hash[field] = convert_to_hash(field_value) unless field_value.nil?
23
- hash
24
- end
25
- end
@@ -1,14 +0,0 @@
1
- module RangeMethods
2
- def range
3
- @range ||= Range.new(Float(beginning), Float(self.end), exclude_end: true)
4
- end
5
-
6
- def beginning=(value)
7
- @beginning = (value == "-INF") ? -Float::INFINITY : value
8
- end
9
-
10
- def end=(value)
11
- @end = (value == "INF") ? Float::INFINITY : value
12
- end
13
- end
14
-