scalingo 3.0.0.beta.2 → 3.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/publish.yml +28 -0
  3. data/.github/workflows/ruby.yml +45 -0
  4. data/.rubocop.yml +16 -0
  5. data/CHANGELOG.md +24 -0
  6. data/README.md +25 -20
  7. data/lib/scalingo/api/client.rb +38 -10
  8. data/lib/scalingo/api/endpoint.rb +12 -2
  9. data/lib/scalingo/api/response.rb +11 -2
  10. data/lib/scalingo/auth/keys.rb +4 -4
  11. data/lib/scalingo/auth/scm_integrations.rb +4 -4
  12. data/lib/scalingo/auth/tokens.rb +6 -6
  13. data/lib/scalingo/auth/two_factor_auth.rb +4 -4
  14. data/lib/scalingo/auth/user.rb +15 -2
  15. data/lib/scalingo/bearer_token.rb +15 -0
  16. data/lib/scalingo/billing/profile.rb +3 -3
  17. data/lib/scalingo/client.rb +26 -113
  18. data/lib/scalingo/configuration.rb +8 -36
  19. data/lib/scalingo/core_client.rb +106 -0
  20. data/lib/scalingo/regional/addons.rb +21 -8
  21. data/lib/scalingo/regional/apps.rb +8 -8
  22. data/lib/scalingo/regional/autoscalers.rb +70 -0
  23. data/lib/scalingo/regional/collaborators.rb +4 -4
  24. data/lib/scalingo/regional/containers.rb +4 -4
  25. data/lib/scalingo/regional/deployments.rb +3 -3
  26. data/lib/scalingo/regional/domains.rb +5 -5
  27. data/lib/scalingo/regional/environment.rb +6 -6
  28. data/lib/scalingo/regional/events.rb +4 -4
  29. data/lib/scalingo/regional/logs.rb +2 -2
  30. data/lib/scalingo/regional/metrics.rb +3 -2
  31. data/lib/scalingo/regional/notifiers.rb +7 -7
  32. data/lib/scalingo/regional/operations.rb +1 -1
  33. data/lib/scalingo/regional/scm_repo_links.rb +8 -8
  34. data/lib/scalingo/regional.rb +2 -0
  35. data/lib/scalingo/token_holder.rb +31 -0
  36. data/lib/scalingo/version.rb +1 -1
  37. data/samples/auth/user/stop-free-trial.json +24 -0
  38. data/samples/regional/addons/token-200.json +49 -0
  39. data/samples/regional/addons/token-404.json +24 -0
  40. data/samples/regional/autoscalers/_meta.json +27 -0
  41. data/samples/regional/autoscalers/create-201.json +49 -0
  42. data/samples/regional/autoscalers/create-500.json +32 -0
  43. data/samples/regional/autoscalers/destroy-204.json +20 -0
  44. data/samples/regional/autoscalers/destroy-404.json +25 -0
  45. data/samples/regional/autoscalers/find-200.json +39 -0
  46. data/samples/regional/autoscalers/find-404.json +25 -0
  47. data/samples/regional/autoscalers/for-200.json +41 -0
  48. data/samples/regional/autoscalers/update-200.json +45 -0
  49. data/samples/regional/autoscalers/update-404.json +31 -0
  50. data/samples/regional/autoscalers/update-500.json +30 -0
  51. data/scalingo.gemspec +8 -8
  52. data/spec/scalingo/api/client_spec.rb +60 -13
  53. data/spec/scalingo/api/endpoint_spec.rb +18 -3
  54. data/spec/scalingo/api/response_spec.rb +32 -16
  55. data/spec/scalingo/auth/user_spec.rb +6 -0
  56. data/spec/scalingo/auth_spec.rb +1 -1
  57. data/spec/scalingo/billing_spec.rb +11 -0
  58. data/spec/scalingo/client_spec.rb +2 -2
  59. data/spec/scalingo/configuration_spec.rb +32 -30
  60. data/spec/scalingo/regional/addons_spec.rb +16 -0
  61. data/spec/scalingo/regional/autoscalers_spec.rb +84 -0
  62. data/spec/scalingo/regional_spec.rb +3 -3
  63. metadata +69 -47
  64. data/.travis.yml +0 -24
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 6582ca860b783b598a3f31874afc37958ead26c29c17c099e6cba1ef094f933d
4
- data.tar.gz: c0206b25118775599be97e0c6a7ef06c40914a34711c882a21268521f964ae24
3
+ metadata.gz: 0c6c044b3045115cfbb02eb44ff90880f115ad308f72962d3a2e396d094d57a1
4
+ data.tar.gz: 108a902824f01dd1bfc7ccd347ce3a1915ff5e68298ad236b8cd786d85f7df1a
5
5
  SHA512:
6
- metadata.gz: 1e7e41bb52927a17d3de0c840f281754ee1907a000db36735ec779d5115a345f91bf944aad068421e9292fcb3ab9f92db49690a25e61f4f81cd8ff45c625f550
7
- data.tar.gz: e2ebc1468f18304b3086ad927db4e89f09ef1d6256395a6f72a089776eeba8643b923bec88af1690f0264786dd46d6982b421f741b99f23a86ec513a3841fba9
6
+ metadata.gz: 2bf6692720bdcaaebf692d5c9e714da314acd0e56cbab9d0d616e308efaeb70ec7bc03e0596e94ba80e554daa9f92bc7519dc8da6eb29faf801c11b4f8099a73
7
+ data.tar.gz: 2ae4d7349ac2cc5821109273b7adf1d489ee9e99c721694c4c6e1f3449ecf2f7c0a4341aea46874c9bb5fa50d1f4642c48fbc4822fe5409bb646c9ae40322790
@@ -0,0 +1,28 @@
1
+ name: Publish gem
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ release:
6
+ types: [created]
7
+
8
+ jobs:
9
+ build:
10
+ runs-on: ubuntu-latest
11
+
12
+ steps:
13
+ - uses: actions/checkout@v2
14
+ - name: Set up Ruby
15
+ uses: ruby/setup-ruby@v1
16
+ with:
17
+ ruby-version: 3.0
18
+ bundler-cache: true
19
+ - name: Publish to RubyGems
20
+ run: |
21
+ mkdir -p $HOME/.gem
22
+ touch $HOME/.gem/credentials
23
+ chmod 0600 $HOME/.gem/credentials
24
+ printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
25
+ gem build *.gemspec
26
+ gem push *.gem
27
+ env:
28
+ GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
@@ -0,0 +1,45 @@
1
+ # This workflow uses actions that are not certified by GitHub.
2
+ # They are provided by a third-party and are governed by
3
+ # separate terms of service, privacy policy, and support
4
+ # documentation.
5
+ # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
+ # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
+
8
+ name: CI - PR/master
9
+
10
+ on:
11
+ workflow_dispatch:
12
+ push:
13
+ branches: [ master ]
14
+ pull_request:
15
+ branches: [ master ]
16
+
17
+ jobs:
18
+ lint:
19
+ runs-on: ubuntu-latest
20
+ steps:
21
+ - uses: actions/checkout@v2
22
+ - name: Set up Ruby
23
+ uses: ruby/setup-ruby@v1
24
+ with:
25
+ ruby-version: 3.0
26
+ bundler-cache: true
27
+ - name: Rubocop checks
28
+ run: bundle exec rubocop
29
+
30
+ test:
31
+ runs-on: ubuntu-latest
32
+ strategy:
33
+ matrix:
34
+ ruby-version: ['2.6', '2.7', '3.0']
35
+ steps:
36
+ - uses: actions/checkout@v2
37
+ - name: Set up Ruby
38
+ # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
39
+ # change this to (see https://github.com/ruby/setup-ruby#versioning):
40
+ uses: ruby/setup-ruby@v1
41
+ with:
42
+ ruby-version: ${{ matrix.ruby-version }}
43
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
44
+ - name: Run tests
45
+ run: bundle exec rake
data/.rubocop.yml CHANGED
@@ -7,10 +7,26 @@ require:
7
7
  - standard
8
8
  - rubocop-performance
9
9
 
10
+ AllCops:
11
+ SuggestExtensions: false
12
+ Exclude:
13
+ - 'node_modules/**/*'
14
+ - 'tmp/**/*'
15
+ - 'vendor/**/*'
16
+ - '.git/**/*'
17
+
10
18
  Style/TrailingCommaInArguments:
11
19
  Enabled: true
12
20
  EnforcedStyleForMultiline: consistent_comma
13
21
 
22
+ Style/TrailingCommaInArrayLiteral:
23
+ Enabled: true
24
+ EnforcedStyleForMultiline: consistent_comma
25
+
26
+ Style/TrailingCommaInHashLiteral:
27
+ Enabled: true
28
+ EnforcedStyleForMultiline: consistent_comma
29
+
14
30
  Style/Alias:
15
31
  Enabled: true
16
32
  EnforcedStyle: prefer_alias_method
data/CHANGELOG.md CHANGED
@@ -1,5 +1,29 @@
1
1
  ## Unreleased
2
2
 
3
+ ## 3.1.0
4
+
5
+ * Compat: support for ActiveSupport (and therefore Rails) 7, @Intrepidd
6
+
7
+ ## 3.0.1
8
+
9
+ * Internals: allow `unpack` to dig into nested structures
10
+
11
+ ## 3.0.0
12
+
13
+ * New: Regional API autoscalers endpoints
14
+ * New: User#stop_free_trial method
15
+
16
+ ## 3.0.0.beta.3 - 2020/08/15
17
+
18
+ * Change: Requests have the header `Accept: application/json` by default
19
+ * Private API Change: `unpack` signature
20
+ * Change: allow api clients standalone use (without a main scalingo client)
21
+ * Change: remove regions-related configuration, except for the default region
22
+ * Bugfix: remove `https` configuration option (development artifact) (#20)
23
+ * Improv: configure the faraday adapter to use (#20)
24
+ * Improv: prettier `inspect` for common objects (#20)
25
+ * New: Add `addons#token` endpoint (#20)
26
+
3
27
  ## 3.0.0.beta.2 - 2020/06/18
4
28
 
5
29
  * Bugfix: do not "dig" into the response body if it is not a 2XX (#18, #19)
data/README.md CHANGED
@@ -10,15 +10,10 @@ will therefore be `3.x.x`.
10
10
 
11
11
  You can check the version 2 at [the v2 branch of this repository](https://github.com/Scalingo/scalingo-ruby-api/tree/v2)
12
12
 
13
- ### The road to 3.0.0
14
-
15
- This gem is still in beta version, but its API should not change a lot until a final release.
16
- [This issue tracks the remaining work](https://github.com/Scalingo/scalingo-ruby-api/issues/13).
17
-
18
13
  ## Installation
19
14
 
20
15
  ```ruby
21
- gem "scalingo", "3.0.0.beta.2"
16
+ gem "scalingo", "3.0.0"
22
17
  ```
23
18
 
24
19
  And then execute:
@@ -63,20 +58,7 @@ changing the configuration globally will therefore not affect already existing o
63
58
 
64
59
  ```ruby
65
60
  Scalingo.configure do |config|
66
- # Authentication API url
67
- config.auth = "https://auth.scalingo.com/v1"
68
-
69
- # Billing API url
70
- config.billing = "https://cashmachine.scalingo.com"
71
-
72
- # Known regions and their api's url
73
- config.regions = {
74
- agora_fr1: "https://api.agora-fr1.scalingo.com/v1",
75
- osc_fr1: "https://api.osc-fr1.scalingo.com/v1",
76
- osc_secnum_fr1: "https://api.osc-secnum-fr1.scalingo.com/v1"
77
- }
78
-
79
- # Default region. Must match an entry in `regions`
61
+ # Default region. Must be a supported region (agora_fr1, osc_fr1, osc_secnum_fr1)
80
62
  config.default_region = :osc_fr1
81
63
 
82
64
  # Configure the User Agent header
@@ -95,6 +77,9 @@ Scalingo.configure do |config|
95
77
  # These headers will be added to every request. Individual methods may override them.
96
78
  # This should be a hash or a callable object that returns a hash.
97
79
  config.additional_headers = {}
80
+
81
+ # Specify an adapter for faraday. Leave nil for the default one (Net::HTTP)
82
+ config.faraday_adapter = nil
98
83
  end
99
84
  ```
100
85
 
@@ -159,3 +144,23 @@ scalingo.osc_fr1.apps.all # OR scalingo.region(:osc_fr1).apps.all
159
144
  # Preview the creation of an app on the default region
160
145
  scalingo.apps.create(name: "my-new-app", dry_run: true)
161
146
  ```
147
+
148
+ ## Development
149
+
150
+ ### Install
151
+
152
+ ```bash
153
+ bundle
154
+ ```
155
+
156
+ ### Run tests
157
+
158
+ ```bash
159
+ bundle exec rake test
160
+ ```
161
+
162
+ ### Release a new version
163
+
164
+ ```bash
165
+ # TODO
166
+ ```
@@ -1,11 +1,24 @@
1
+ require "scalingo/token_holder"
2
+
1
3
  module Scalingo
2
4
  module API
3
5
  class Client
4
- attr_reader :scalingo, :url
6
+ include TokenHolder
7
+
8
+ attr_reader :config, :token_holder, :url
5
9
 
6
- def initialize(scalingo, url)
7
- @scalingo = scalingo
10
+ def initialize(url, scalingo: nil, config: {})
8
11
  @url = url
12
+ parent_config = Scalingo.config
13
+
14
+ if scalingo
15
+ @token_holder = scalingo
16
+ parent_config = scalingo.config
17
+ else
18
+ @token_holder = self
19
+ end
20
+
21
+ @config = Configuration.new(config, parent_config)
9
22
  end
10
23
 
11
24
  def self.register_handlers!(handlers)
@@ -27,13 +40,24 @@ module Scalingo
27
40
  end
28
41
  end
29
42
 
43
+ def inspect
44
+ str = %(<#{self.class}:0x#{object_id.to_s(16)} url:"#{@url}" methods:)
45
+
46
+ methods = self.class.instance_methods - Scalingo::API::Client.instance_methods
47
+ str << methods.to_s
48
+
49
+ str << ">"
50
+ str
51
+ end
52
+
30
53
  ## Faraday objects
31
54
  def headers
32
55
  hash = {
33
- "User-Agent" => scalingo.config.user_agent
56
+ "User-Agent" => config.user_agent,
57
+ "Accept" => "application/json",
34
58
  }
35
59
 
36
- if (extra = scalingo.config.additional_headers).present?
60
+ if (extra = config.additional_headers).present?
37
61
  extra.respond_to?(:call) ? hash.update(extra.call) : hash.update(extra)
38
62
  end
39
63
 
@@ -43,7 +67,7 @@ module Scalingo
43
67
  def connection_options
44
68
  {
45
69
  url: url,
46
- headers: headers
70
+ headers: headers,
47
71
  }
48
72
  end
49
73
 
@@ -66,6 +90,8 @@ module Scalingo
66
90
  @unauthenticated_conn ||= Faraday.new(connection_options) { |conn|
67
91
  conn.response :json, content_type: /\bjson$/, parser_options: {symbolize_names: true}
68
92
  conn.request :json
93
+
94
+ conn.adapter(config.faraday_adapter) if config.faraday_adapter
69
95
  }
70
96
  end
71
97
 
@@ -73,8 +99,8 @@ module Scalingo
73
99
  return @connection if @connection
74
100
 
75
101
  # Missing token handling. Token expiration is handled in the `value` method.
76
- unless scalingo.token&.value
77
- if scalingo.config.raise_on_missing_authentication
102
+ unless token_holder.token&.value
103
+ if config.raise_on_missing_authentication
78
104
  raise Error::Unauthenticated
79
105
  else
80
106
  return unauthenticated_connection
@@ -85,10 +111,12 @@ module Scalingo
85
111
  conn.response :json, content_type: /\bjson$/, parser_options: {symbolize_names: true}
86
112
  conn.request :json
87
113
 
88
- if scalingo.token&.value
89
- auth_header = Faraday::Request::Authorization.header "Bearer", scalingo.token.value
114
+ if token_holder.token&.value
115
+ auth_header = Faraday::Request::Authorization.header "Bearer", token_holder.token.value
90
116
  conn.headers[Faraday::Request::Authorization::KEY] = auth_header
91
117
  end
118
+
119
+ conn.adapter(config.faraday_adapter) if config.faraday_adapter
92
120
  }
93
121
  end
94
122
  end
@@ -13,10 +13,20 @@ module Scalingo
13
13
 
14
14
  def_delegator :client, :connection
15
15
 
16
+ def inspect
17
+ str = %(<#{self.class}:0x#{object_id.to_s(16)} base_url:"#{@client.url}" endpoints:)
18
+
19
+ methods = self.class.instance_methods - Scalingo::API::Endpoint.instance_methods
20
+
21
+ str << methods.to_s
22
+ str << ">"
23
+ str
24
+ end
25
+
16
26
  private
17
27
 
18
- def unpack(*args)
19
- Response.unpack(client, *args)
28
+ def unpack(*keys, &block)
29
+ Response.unpack(client, keys: keys, &block)
20
30
  end
21
31
  end
22
32
  end
@@ -1,7 +1,9 @@
1
1
  module Scalingo
2
2
  module API
3
3
  class Response
4
- def self.unpack(client, response, key: nil)
4
+ def self.unpack(client, key: nil, keys: nil, &block)
5
+ response = block.call
6
+
5
7
  body = response.body
6
8
  has_hash_body = body.present? && body.respond_to?(:key)
7
9
 
@@ -9,7 +11,10 @@ module Scalingo
9
11
  meta = nil
10
12
 
11
13
  if has_hash_body
12
- data = body[key] if response.success? && key.present?
14
+ keys = [key] if key.present?
15
+
16
+ data = body.dig(*keys) if response.success? && keys.present?
17
+
13
18
  meta = body[:meta]
14
19
  end
15
20
 
@@ -34,6 +39,10 @@ module Scalingo
34
39
  @meta = meta
35
40
  end
36
41
 
42
+ def inspect
43
+ %(<#{self.class}:0x#{object_id.to_s(16)} status:#{@status} data:#{@data} meta:#{@meta}>)
44
+ end
45
+
37
46
  def successful?
38
47
  status >= 200 && status < 300
39
48
  end
@@ -12,7 +12,7 @@ module Scalingo
12
12
  &block
13
13
  )
14
14
 
15
- unpack(response, key: :keys)
15
+ unpack(:keys) { response }
16
16
  end
17
17
 
18
18
  def show(id, headers = nil, &block)
@@ -25,7 +25,7 @@ module Scalingo
25
25
  &block
26
26
  )
27
27
 
28
- unpack(response, key: :key)
28
+ unpack(:key) { response }
29
29
  end
30
30
 
31
31
  def create(payload, headers = nil, &block)
@@ -38,7 +38,7 @@ module Scalingo
38
38
  &block
39
39
  )
40
40
 
41
- unpack(response, key: :key)
41
+ unpack(:key) { response }
42
42
  end
43
43
 
44
44
  def destroy(id, headers = nil, &block)
@@ -50,7 +50,7 @@ module Scalingo
50
50
  &block
51
51
  )
52
52
 
53
- unpack(response)
53
+ unpack { response }
54
54
  end
55
55
  end
56
56
  end
@@ -12,7 +12,7 @@ module Scalingo
12
12
  &block
13
13
  )
14
14
 
15
- unpack(response, key: :scm_integrations)
15
+ unpack(:scm_integrations) { response }
16
16
  end
17
17
 
18
18
  def show(id, headers = nil, &block)
@@ -25,7 +25,7 @@ module Scalingo
25
25
  &block
26
26
  )
27
27
 
28
- unpack(response, key: :scm_integration)
28
+ unpack(:scm_integration) { response }
29
29
  end
30
30
 
31
31
  def create(payload, headers = nil, &block)
@@ -38,7 +38,7 @@ module Scalingo
38
38
  &block
39
39
  )
40
40
 
41
- unpack(response, key: :scm_integration)
41
+ unpack(:scm_integration) { response }
42
42
  end
43
43
 
44
44
  def destroy(id, headers = nil, &block)
@@ -51,7 +51,7 @@ module Scalingo
51
51
  &block
52
52
  )
53
53
 
54
- unpack(response)
54
+ unpack { response }
55
55
  end
56
56
  end
57
57
  end
@@ -8,7 +8,7 @@ module Scalingo
8
8
  authorization = Faraday::Request::BasicAuthentication.header("", token)
9
9
 
10
10
  request_headers = {
11
- Faraday::Request::Authorization::KEY => authorization
11
+ Faraday::Request::Authorization::KEY => authorization,
12
12
  }
13
13
 
14
14
  request_headers.update(headers) if headers
@@ -20,7 +20,7 @@ module Scalingo
20
20
  &block
21
21
  )
22
22
 
23
- unpack(response)
23
+ unpack { response }
24
24
  end
25
25
 
26
26
  def all(headers = nil, &block)
@@ -33,7 +33,7 @@ module Scalingo
33
33
  &block
34
34
  )
35
35
 
36
- unpack(response, key: :tokens)
36
+ unpack(:tokens) { response }
37
37
  end
38
38
 
39
39
  def create(payload, headers = nil, &block)
@@ -46,7 +46,7 @@ module Scalingo
46
46
  &block
47
47
  )
48
48
 
49
- unpack(response, key: :token)
49
+ unpack(:token) { response }
50
50
  end
51
51
 
52
52
  def renew(id, headers = nil, &block)
@@ -59,7 +59,7 @@ module Scalingo
59
59
  &block
60
60
  )
61
61
 
62
- unpack(response, key: :token)
62
+ unpack(:token) { response }
63
63
  end
64
64
 
65
65
  def destroy(id, headers = nil, &block)
@@ -72,7 +72,7 @@ module Scalingo
72
72
  &block
73
73
  )
74
74
 
75
- unpack(response)
75
+ unpack { response }
76
76
  end
77
77
  end
78
78
  end
@@ -16,7 +16,7 @@ module Scalingo
16
16
  &block
17
17
  )
18
18
 
19
- unpack(response, key: :tfa)
19
+ unpack(:tfa) { response }
20
20
  end
21
21
 
22
22
  def initiate(provider = DEFAULT_PROVIDER, headers = nil, &block)
@@ -29,7 +29,7 @@ module Scalingo
29
29
  &block
30
30
  )
31
31
 
32
- unpack(response, key: :tfa)
32
+ unpack(:tfa) { response }
33
33
  end
34
34
 
35
35
  def validate(attempt, headers = nil, &block)
@@ -42,7 +42,7 @@ module Scalingo
42
42
  &block
43
43
  )
44
44
 
45
- unpack(response, key: :tfa)
45
+ unpack(:tfa) { response }
46
46
  end
47
47
 
48
48
  def disable(headers = nil, &block)
@@ -55,7 +55,7 @@ module Scalingo
55
55
  &block
56
56
  )
57
57
 
58
- unpack(response, key: :tfa)
58
+ unpack(:tfa) { response }
59
59
  end
60
60
  end
61
61
  end
@@ -12,7 +12,7 @@ module Scalingo
12
12
  &block
13
13
  )
14
14
 
15
- unpack(response, key: :user)
15
+ unpack(:user) { response }
16
16
  end
17
17
 
18
18
  def update(payload, headers = nil, &block)
@@ -25,7 +25,20 @@ module Scalingo
25
25
  &block
26
26
  )
27
27
 
28
- unpack(response, key: :user)
28
+ unpack(:user) { response }
29
+ end
30
+
31
+ def stop_free_trial(headers = nil, &block)
32
+ data = nil
33
+
34
+ response = connection.post(
35
+ "users/stop_free_trial",
36
+ data,
37
+ headers,
38
+ &block
39
+ )
40
+
41
+ unpack { response }
29
42
  end
30
43
  end
31
44
  end
@@ -9,6 +9,21 @@ module Scalingo
9
9
  @raise_on_expired = raise_on_expired
10
10
  end
11
11
 
12
+ def inspect
13
+ str = "<#{self.class}:0x#{object_id.to_s(16)} "
14
+
15
+ str << if expired?
16
+ "(expired) "
17
+ elsif expires_at.present?
18
+ "expires_at: #{expires_at} "
19
+ else
20
+ "(no expiration) "
21
+ end
22
+
23
+ str << %(value:"#{value}">)
24
+ str
25
+ end
26
+
12
27
  def raise_on_expired?
13
28
  @raise_on_expired
14
29
  end
@@ -12,7 +12,7 @@ module Scalingo
12
12
  &block
13
13
  )
14
14
 
15
- unpack(response, key: :profile)
15
+ unpack(:profile) { response }
16
16
  end
17
17
 
18
18
  def create(payload = {}, headers = nil, &block)
@@ -25,7 +25,7 @@ module Scalingo
25
25
  &block
26
26
  )
27
27
 
28
- unpack(response, key: :profile)
28
+ unpack(:profile) { response }
29
29
  end
30
30
 
31
31
  def update(id, payload = {}, headers = nil, &block)
@@ -38,7 +38,7 @@ module Scalingo
38
38
  &block
39
39
  )
40
40
 
41
- unpack(response, key: :profile)
41
+ unpack(:profile) { response }
42
42
  end
43
43
 
44
44
  alias_method :self, :show