wes-data-api 2.2.0 → 2.3.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: 05a80418eccc3c87d92728b3645fa6a928b68053
4
- data.tar.gz: c2135612f62fcf996ac3ac2157cb4e21ad90ae34
3
+ metadata.gz: a9b52a14035dee65b5db2838a4f30f8208e74d10
4
+ data.tar.gz: 903d38e12cff42e246b0059b4ed330c0812e254e
5
5
  SHA512:
6
- metadata.gz: 8561e2628a414a3d244556fe2786dbc032d923d897877a6926bef20658ac9affa90f56d3639043a5e2c5552ad24293b358362cf505f7d3e961bc75466382691f
7
- data.tar.gz: 79782972a32dae5c63bc9f14a3a537e372a4563d6db3f4dd3dccce106e4de62fb38b2ed2d612542843d3b0f407f03bef4e75845fef031431e2280f7ee3b21a00
6
+ metadata.gz: 5d6c70f4346372bba644f5bb2b7ecdecb214a15279d34d73cec824d398cb2d01973f5c4eb7c91b5eb08f33aee8c38795d7259740687dd2fb08af9945c491a7d8
7
+ data.tar.gz: 81fac74d73011b6bd18a46d5375584bba1e37c43a97cc5ec31f930c2e5174aad5c83c0dac21689b42a171fa9873c9a48e92d810f69d7ce5e23210de83bd28bad
@@ -0,0 +1,75 @@
1
+ require "wes/data/api/client"
2
+ require "wes/data/api/configuration"
3
+
4
+ module Wes
5
+ module Data
6
+ module API
7
+ class Billing
8
+ attr_reader :attributes
9
+
10
+ def initialize(attributes)
11
+ @attributes = attributes
12
+ end
13
+
14
+ class << self
15
+ def client
16
+ Client.new
17
+ end
18
+
19
+ def configuration
20
+ Configuration
21
+ end
22
+
23
+ def create(data)
24
+ attributes = client.post("#{routes.billing}", data).first
25
+ new(attributes)
26
+ end
27
+
28
+ def find(key, value)
29
+ attrs = case key
30
+ when :id
31
+ client.get("#{routes.billing}/#{value}")
32
+ when :user_id
33
+ client.get("#{routes.user}/#{value}/billing")
34
+ end
35
+ new(attrs.first)
36
+ end
37
+
38
+ def routes
39
+ configuration.routes
40
+ end
41
+ end
42
+
43
+ def exist?
44
+ !@attributes.nil?
45
+ end
46
+
47
+ def method_missing(method_sym)
48
+ attributes.send method_sym
49
+ end
50
+
51
+ def update(changes)
52
+ @attributes = client.put(
53
+ "#{routes.billing}/#{id}",
54
+ @attributes.to_h.merge(changes)
55
+ ).first
56
+ self
57
+ end
58
+
59
+ private
60
+
61
+ def client
62
+ self.class.client
63
+ end
64
+
65
+ def id
66
+ attributes.id
67
+ end
68
+
69
+ def routes
70
+ self.class.routes
71
+ end
72
+ end
73
+ end
74
+ end
75
+ end
@@ -1,7 +1,7 @@
1
1
  module Wes
2
2
  module Data
3
3
  module API
4
- VERSION = "2.2.0".freeze
4
+ VERSION = "2.3.0".freeze
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,111 +1,111 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: wes-data-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.0
4
+ version: 2.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - ''
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-04-21 00:00:00.000000000 Z
11
+ date: 2016-04-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.9'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.9'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: pry
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: '0'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '10.0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '10.0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rspec
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ~>
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
61
  version: '3.0'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ~>
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '3.0'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: faraday
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - '>='
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '0'
76
76
  type: :runtime
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - '>='
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: faraday_middleware
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - '>='
87
+ - - ">="
88
88
  - !ruby/object:Gem::Version
89
89
  version: '0'
90
90
  type: :runtime
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - '>='
94
+ - - ">="
95
95
  - !ruby/object:Gem::Version
96
96
  version: '0'
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: json
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - '>='
101
+ - - ">="
102
102
  - !ruby/object:Gem::Version
103
103
  version: '0'
104
104
  type: :runtime
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - '>='
108
+ - - ">="
109
109
  - !ruby/object:Gem::Version
110
110
  version: '0'
111
111
  description:
@@ -117,6 +117,7 @@ extra_rdoc_files: []
117
117
  files:
118
118
  - Gemfile
119
119
  - lib/wes/data/api.rb
120
+ - lib/wes/data/api/billing.rb
120
121
  - lib/wes/data/api/brand.rb
121
122
  - lib/wes/data/api/challenge.rb
122
123
  - lib/wes/data/api/client.rb
@@ -140,17 +141,17 @@ require_paths:
140
141
  - lib
141
142
  required_ruby_version: !ruby/object:Gem::Requirement
142
143
  requirements:
143
- - - '>='
144
+ - - ">="
144
145
  - !ruby/object:Gem::Version
145
146
  version: '0'
146
147
  required_rubygems_version: !ruby/object:Gem::Requirement
147
148
  requirements:
148
- - - '>='
149
+ - - ">="
149
150
  - !ruby/object:Gem::Version
150
151
  version: '0'
151
152
  requirements: []
152
153
  rubyforge_project:
153
- rubygems_version: 2.0.14.1
154
+ rubygems_version: 2.5.1
154
155
  signing_key:
155
156
  specification_version: 4
156
157
  summary: ''