grape-client 0.3.0 → 0.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3d99e13172df1dbea1cdcd2e85d189ef17d4399d
4
- data.tar.gz: 2ac2dffcf2dad4ff2c9c4a6ae8d082b86272a84a
3
+ metadata.gz: f778c9c9490d2a4ca55036ac634f6d2c756224f5
4
+ data.tar.gz: 374ef037944a5e988a6479b297d2eb02f249b225
5
5
  SHA512:
6
- metadata.gz: 9e5d85cad27a76b8272d449478b6e1fd3e796993df972f87195537fd6fd1fe59dba9dd78f9b55ed6fc4e40b306925ccd19aa33b8626b5e050f787740caadbe8a
7
- data.tar.gz: 94b0242a1d87f4057f3c051cf7514f73b6cfa22e42989ff42868d14674bdac9f242243dd3392141bcb3d97921594e92b674428d017e747f6794f57db3aabe2dd
6
+ metadata.gz: 53b9f9bbd6d40bb80db727c4a004705f9f485dda500a86850d18ec6789a86c4fdb0604d31451e7c350cb584c381a491d088fcc39294f5a33154cc6ba1644231a
7
+ data.tar.gz: 4cf5927a28c13e720098fb23bf7d5537c3710d607d8c8cb8f274334a9a8a54b3cf281a508eb2204a7d3b57d1014ac0ed08c9abb2c7693e8df57e78744c1f88de
@@ -1,6 +1,6 @@
1
1
  # This configuration was generated by
2
2
  # `rubocop --auto-gen-config`
3
- # on 2016-03-23 18:23:13 +0200 using RuboCop version 0.37.2.
3
+ # on 2016-03-27 13:31:12 +0300 using RuboCop version 0.37.2.
4
4
  # The point is for the user to remove these configuration records
5
5
  # one by one as the offenses are removed from the code base.
6
6
  # Note that changes in the inspected code, or installation of new
@@ -8,9 +8,9 @@
8
8
 
9
9
  # Offense count: 1
10
10
  Metrics/AbcSize:
11
- Max: 19
11
+ Max: 18
12
12
 
13
- # Offense count: 9
13
+ # Offense count: 8
14
14
  # Configuration parameters: AllowHeredoc, AllowURI, URISchemes.
15
15
  # URISchemes: http, https
16
16
  Metrics/LineLength:
@@ -9,4 +9,13 @@ module GrapeClient
9
9
 
10
10
  autoload file.camelize, "grape_client/#{file}"
11
11
  end
12
+
13
+ class << self
14
+ attr_accessor :configuration
15
+
16
+ def configure
17
+ self.configuration ||= Configuration.new
18
+ yield(configuration)
19
+ end
20
+ end
12
21
  end
@@ -2,7 +2,6 @@ module GrapeClient
2
2
  class Base
3
3
  include RestMethodsMember
4
4
 
5
- mattr_accessor :site, :user, :password, :prefix
6
5
  attr_reader :attributes
7
6
 
8
7
  class << self
@@ -10,8 +9,16 @@ module GrapeClient
10
9
  include BelongsTo
11
10
  include HasMany
12
11
 
12
+ mattr_accessor :attributes
13
+ mattr_accessor :site, :user, :password, :prefix
14
+
15
+ self.attributes = []
16
+ self.site = GrapeClient.configuration.site
17
+ self.user = GrapeClient.configuration.user
18
+ self.password = GrapeClient.configuration.password
19
+ self.prefix = GrapeClient.configuration.prefix
20
+
13
21
  def attr_accessor(*names)
14
- attributes = self.attributes
15
22
  names.each do |name|
16
23
  attributes << name.to_sym
17
24
  end
@@ -32,11 +39,6 @@ module GrapeClient
32
39
  def endpoint
33
40
  site + prefix + entity_name.pluralize
34
41
  end
35
-
36
- def attributes
37
- class_variable_set('@@attributes', []) unless class_variable_defined?('@@attributes')
38
- class_variable_get('@@attributes')
39
- end
40
42
  end
41
43
 
42
44
  def initialize(attrs = {})
@@ -0,0 +1,5 @@
1
+ module GrapeClient
2
+ class Configuration
3
+ attr_accessor :site, :user, :password, :prefix
4
+ end
5
+ end
@@ -1,3 +1,3 @@
1
1
  module GrapeClient
2
- VERSION = '0.3.0'.freeze
2
+ VERSION = '0.3.1'.freeze
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grape-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dmitry Silchenko
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-03-23 00:00:00.000000000 Z
11
+ date: 2016-03-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -91,6 +91,7 @@ files:
91
91
  - lib/grape_client/belongs_to.rb
92
92
  - lib/grape_client/cache.rb
93
93
  - lib/grape_client/collection.rb
94
+ - lib/grape_client/configuration.rb
94
95
  - lib/grape_client/connection.rb
95
96
  - lib/grape_client/has_many.rb
96
97
  - lib/grape_client/response_parser.rb