pupper 0.1.3 → 0.1.4

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 88cc1bcf790648e364ec0fdf5dc2608eecb06fa9
4
- data.tar.gz: 3816e0b4a3ea4ca5e509ab3c86c8ec02d48a5a34
3
+ metadata.gz: da1228421c6ae38ceac9673bba44acaec488541a
4
+ data.tar.gz: 80ca69cc2e867f6bea0d49c389e70ebd07df1200
5
5
  SHA512:
6
- metadata.gz: 92d6a8f6f81fcc44e693afc419ccd471b7ddba89c01fff40bb8fdf6a01ff0ee2541adbc18d7b8b72e527988d3204a89742dd6a9e6ced3c42da8b034700d865fb
7
- data.tar.gz: a9edb58740d47a2c09061253ce8327606540451db83751ee47a1c45761a85229329571c1eadbbfa38a92efb5a8fb74b89062c83f789128f8a84c6665732ffd7c
6
+ metadata.gz: c3bb052ba41f3ea2c7ec9f4e6d33e97fb764f39ef6c8d78645880a55038e62deba6fb4a23701cbdaea283401f111907e955531759423a2fbacb2b33b952b6966
7
+ data.tar.gz: 8fa6107e50e9083ea058a88e6c338514e237e13ca72cbd847b3d544f0380d2a78f8bb34353c94d636140c7b8bf2832cd2932d209ed1b174bffac05075c82cee9
data/lib/pupper/model.rb CHANGED
@@ -40,18 +40,33 @@ module Pupper
40
40
  class_methods do
41
41
  attr_writer :primary_key, :backend, :static
42
42
 
43
+ # @overload primary_key=(identifier)
44
+ # Set the identifier the including model will use by default
45
+ # when finding or updating (defaults to `:uid`)
46
+ #
47
+ # == Parameters:
48
+ # identifier::
49
+ # A symbol refering to the identifying field in the model. e.g.
50
+ # `:id`.
43
51
  def primary_key
44
52
  @primary_key ||= :uid
45
53
  end
46
54
 
55
+ # @overload static=(true_or_false)
56
+ # Declare whether or not the model has a corresponding API client or not.
57
+ # (default: `false`)
58
+ #
59
+ # == Parameters:
60
+ # true_or_false::
61
+ # `true` if the model has no API, `false` otherwise.
47
62
  def static?
48
63
  @static ||= false
49
64
  end
50
65
 
51
66
  def backend
67
+ return if static?
52
68
  @backend ||= "#{model_name.name.pluralize}Client".constantize.new
53
69
  rescue NameError
54
- return unless static?
55
70
  raise NoSuchBackend, <<-ERR
56
71
  Model #{model_name.name} is looking for an API client that doesn't exist!
57
72
 
@@ -1,3 +1,3 @@
1
1
  module Pupper
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pupper
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lee Machin