get_your_rep 1.1.1 → 1.2.0

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: 16f153f283c9e1fa3758cd00a95076e318d2a6d8
4
- data.tar.gz: 3fc24259b1df82dd1f487ad198d8335901509084
3
+ metadata.gz: '0388947f306d533d91278127114e1370683aed23'
4
+ data.tar.gz: 2421a7f952d3bfec07f606cde2d84e0df4aab870
5
5
  SHA512:
6
- metadata.gz: 82bcfba877ab98d8240ce1125d93b08a7978f5375100c1cf40067bc4bab00c88e2d809ac7a4ea87fe55117f79a6ef48508e7340a217a8381ddb9bdce6796a10f
7
- data.tar.gz: e81f56dd850bea280e7b14d7ead80bb3a8f07d7680185de083cceac0805de859dfeaee3ff87649059c1c1ab1b0e638a2ebaf3725132e9c620bf1923546d1455f
6
+ metadata.gz: 3d23670e51f645fa8e321c458a45c27d7ef607efdbf784f17e961b569668aba2d357f47eefd08a44dad1b3b4c0c6b80e7e2b8300478848c038058337c1a171e2
7
+ data.tar.gz: 6f3433654afe83758ce0c52b314f7a38f5aa95811230febadad99b5ea1ea776025b1d96f2e4e8b566fd09925906651e7bd72b216f43e1e54deb8ab3e079f558d
data/LICENSE CHANGED
@@ -1,6 +1,6 @@
1
1
  MIT License
2
2
 
3
- Copyright (c) 2016 m. simon borg
3
+ Copyright (c) 2016-2017 m. simon borg
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -1,3 +1,4 @@
1
+ [![Code Climate](https://codeclimate.com/github/msimonborg/get-your-rep/badges/gpa.svg)](https://codeclimate.com/github/msimonborg/get-your-rep)
1
2
  # Get yo' rep!
2
3
 
3
4
  This is the companion [gem](https://rubygems.org/gems/get_your_rep) for the [Phone Your Rep API] (https://github.com/msimonborg/phone-your-rep-api)
@@ -3,19 +3,9 @@
3
3
  module GetYourRep
4
4
  # Methods for making associations between objects.
5
5
  module Associations
6
- def add_child(other:, model:, children:, parent:, error:)
6
+ def add_child(other:, model:, children:, error:)
7
7
  if other.is_a?(model)
8
8
  instance_variable_get("@#{children}") << other
9
- other.send("#{parent}=", self) unless other.send(parent.to_s) == self
10
- else
11
- error.call
12
- end
13
- end
14
-
15
- def add_parent(other:, model:, parent:, child:, error:)
16
- if other.is_a?(model)
17
- instance_variable_set("@#{parent}", other)
18
- other.send("add_#{child}", self) unless other.send("#{child}s").include?(self)
19
9
  else
20
10
  error.call
21
11
  end
@@ -44,7 +44,6 @@ module GetYourRep
44
44
  add_child other: other,
45
45
  model: Representative,
46
46
  children: :reps,
47
- parent: :delegation,
48
47
  error: -> { not_a_rep_error }
49
48
  end
50
49
 
@@ -25,15 +25,6 @@ module GetYourRep
25
25
  end
26
26
  end
27
27
 
28
- # Set the rep attribute to an instance of a Representative, and make two-way association.
29
- def rep=(other)
30
- add_parent other: other,
31
- model: Representative,
32
- parent: :rep,
33
- child: :office_location,
34
- error: -> { not_a_rep_error }
35
- end
36
-
37
28
  # Display self attributes for CLI.
38
29
  def cli_display
39
30
  puts " #{type.capitalize} Office".bold.blue
@@ -22,16 +22,6 @@ module GetYourRep
22
22
  end
23
23
  end
24
24
 
25
- # Sets the Delegation object that the instance belongs to. Will add self to the Delegation's
26
- # reps if not done so already.
27
- def delegation=(other)
28
- add_parent other: other,
29
- model: Delegation,
30
- parent: :delegation,
31
- child: :rep,
32
- error: -> { not_a_del_error }
33
- end
34
-
35
25
  # Returns a frozen duplicate of the office_locations array.
36
26
  def office_locations
37
27
  @office_locations.dup.freeze
@@ -47,7 +37,6 @@ module GetYourRep
47
37
  add_child other: other,
48
38
  model: OfficeLocation,
49
39
  children: :office_locations,
50
- parent: :rep,
51
40
  error: -> { not_an_office_error }
52
41
  end
53
42
 
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module GetYourRep
3
- VERSION = '1.1.1' # :nodoc:
3
+ VERSION = '1.2.0' # :nodoc:
4
4
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: get_your_rep
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - msimonborg
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-04-03 00:00:00.000000000 Z
11
+ date: 2017-05-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty