ncore 1.2.0 → 1.2.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +15 -0
- data/lib/ncore/associations.rb +0 -33
- data/lib/ncore/client.rb +6 -5
- data/lib/ncore/configuration.rb +0 -5
- data/lib/ncore/version.rb +1 -1
- data/ncore.gemspec +0 -2
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ec1bdffa679ca20445f4b48c4f7dd4cfcf6b2076
|
4
|
+
data.tar.gz: 7403cc773dc32014c0b9717fcb8d8fac6c433eb3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4d98693b19a89b725457faf351417e64d150964a8dfddb17d49535479f7b4410836dd47f6c90da96d2ea18b8073ab172ff9d5e7a2c022f2283caa6c55eb36318
|
7
|
+
data.tar.gz: b187d445f6273acc6b777a0adad97dfaeb41541573c3566f3d7c4d78fcbfe3f3e519df4d90dc9a178676e3e13a33af05d43ef2947b7a75f1de46fdce84be5687
|
data/CHANGELOG.md
ADDED
data/lib/ncore/associations.rb
CHANGED
@@ -36,8 +36,6 @@ module NCore
|
|
36
36
|
obj = find_#{assoc.singularize}(aid)
|
37
37
|
obj.update(params)
|
38
38
|
obj
|
39
|
-
# raise UnsavedObjectError unless id
|
40
|
-
# #{klass}.update(aid, {#{key}: id}.reverse_merge(params), api_creds)
|
41
39
|
end
|
42
40
|
M4
|
43
41
|
class_eval <<-M5, __FILE__, __LINE__+1
|
@@ -58,8 +56,6 @@ module NCore
|
|
58
56
|
obj = find_#{assoc.singularize}(aid)
|
59
57
|
obj.delete(params)
|
60
58
|
obj
|
61
|
-
# raise UnsavedObjectError unless id
|
62
|
-
# #{klass}.delete(aid, {#{key}: id}.reverse_merge(params), api_creds)
|
63
59
|
end
|
64
60
|
M7
|
65
61
|
class_eval <<-M8, __FILE__, __LINE__+1
|
@@ -70,34 +66,6 @@ module NCore
|
|
70
66
|
M8
|
71
67
|
end
|
72
68
|
|
73
|
-
# def embeds_many(assoc)
|
74
|
-
# assoc = assoc.to_s
|
75
|
-
# class_eval <<-M1, __FILE__, __LINE__+1
|
76
|
-
# def #{assoc}(params={})
|
77
|
-
# @attribs[:#{assoc}] ||= []
|
78
|
-
# end
|
79
|
-
# M1
|
80
|
-
# class_eval <<-M2, __FILE__, __LINE__+1
|
81
|
-
# def find_#{assoc.singularize}(aid)
|
82
|
-
# #{assoc}.detect{|o| o.id == aid} || raise(RecordNotFound)
|
83
|
-
# end
|
84
|
-
# M2
|
85
|
-
#
|
86
|
-
# # appease activerecord:
|
87
|
-
# class_eval <<-M3, __FILE__, __LINE__+1
|
88
|
-
# def #{assoc}_attributes=(v)
|
89
|
-
# v = v.values if v.is_a?(Hash)
|
90
|
-
# if v.is_a?(Array)
|
91
|
-
# v.each{|o| o['object'] ||= '#{assoc.singularize}' if o.is_a?(Hash) }
|
92
|
-
# @attribs[:#{assoc}] = self.class.interpret_type(v, api_creds)
|
93
|
-
# else
|
94
|
-
# @attribs[:#{assoc}] = v
|
95
|
-
# end
|
96
|
-
# end
|
97
|
-
# alias :#{assoc}= :#{assoc}_attributes=
|
98
|
-
# M3
|
99
|
-
# end
|
100
|
-
|
101
69
|
def belongs_to(assoc, klass=nil)
|
102
70
|
assoc = assoc.to_s
|
103
71
|
klass ||= "#{module_name}::#{assoc.camelize}"
|
@@ -105,7 +73,6 @@ module NCore
|
|
105
73
|
attr :#{assoc}_id
|
106
74
|
def #{assoc}(params={})
|
107
75
|
return nil unless #{assoc}_id
|
108
|
-
# @attribs[:#{assoc}] ||= #{klass}.find(#{assoc}_id, params, api_creds)
|
109
76
|
if params.empty?
|
110
77
|
# only cache unfiltered, default api call
|
111
78
|
@attribs[:#{assoc}] ||= #{klass}.find(#{assoc}_id, {}, api_creds)
|
data/lib/ncore/client.rb
CHANGED
@@ -178,10 +178,13 @@ module NCore
|
|
178
178
|
rescue Errno::ECONNREFUSED
|
179
179
|
raise parent::ConnectionError, "Connection error for #{host_for_error rest_opts[:url]} : check network and DNS or visit #{status_page}."
|
180
180
|
rescue Excon::Errors::SocketError => e
|
181
|
-
|
181
|
+
case e.message
|
182
|
+
when /Unable to verify certificate/
|
182
183
|
raise parent::ConnectionError, "Unable to verify certificate for #{host_for_error rest_opts[:url]} : verify URL or disable SSL certificate verification (insecure)."
|
183
|
-
|
184
|
+
when /Name or service not known/
|
184
185
|
raise parent::ConnectionError, "DNS error for #{host_for_error rest_opts[:url]} : check network and DNS or visit #{status_page}."
|
186
|
+
when /Errno::ECONNREFUSED/
|
187
|
+
raise parent::ConnectionError, "Connection error for #{host_for_error rest_opts[:url]} : check network and DNS or visit #{status_page}."
|
185
188
|
else
|
186
189
|
raise e
|
187
190
|
end
|
@@ -200,9 +203,7 @@ module NCore
|
|
200
203
|
raise parent::AccessDenied, "Access denied; check your API credentials and permissions."
|
201
204
|
when 404
|
202
205
|
raise parent::RecordNotFound
|
203
|
-
|
204
|
-
# raise parent::Conflict
|
205
|
-
when 422, 409 # todo: is this really universally true (check both AR + PS)
|
206
|
+
when 422
|
206
207
|
# pass through
|
207
208
|
when 429
|
208
209
|
raise parent::RateLimited
|
data/lib/ncore/configuration.rb
CHANGED
data/lib/ncore/version.rb
CHANGED
data/ncore.gemspec
CHANGED
@@ -10,9 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ["hello@notioneer.com"]
|
11
11
|
spec.description = %q{NCore - Ruby gem useful for building REST API clients}
|
12
12
|
spec.summary = %q{NCore - Gem for building REST API clients}
|
13
|
-
# spec.homepage = "https://github.com/notioneer/ncore-ruby"
|
14
13
|
spec.homepage = 'http://notioneer.com/'
|
15
|
-
# spec.homepage = 'https://authrocket.com/'
|
16
14
|
spec.license = "MIT"
|
17
15
|
|
18
16
|
spec.files = `git ls-files`.split($/)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ncore
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.2.
|
4
|
+
version: 1.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- thomas morgan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-06-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -94,6 +94,7 @@ extensions: []
|
|
94
94
|
extra_rdoc_files: []
|
95
95
|
files:
|
96
96
|
- ".gitignore"
|
97
|
+
- CHANGELOG.md
|
97
98
|
- Gemfile
|
98
99
|
- LICENSE
|
99
100
|
- README.md
|