-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changes from gocardless/gocardless-pro-ruby-template@1270f620323edfc0…
…e45fb145cbf45a92fd5d0529
- Loading branch information
1 parent
ab7af9b
commit 34f85e9
Showing
6 changed files
with
96 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# | ||
# This client is automatically generated from a template and JSON schema definition. | ||
# See https://github.com/gocardless/gocardless-pro-ruby#contributing before editing. | ||
# | ||
|
||
require 'uri' | ||
|
||
module GoCardlessPro | ||
# A module containing classes for each of the resources in the GC Api | ||
module Resources | ||
# Represents an instance of a logo resource returned from the API | ||
|
||
# Logos are image uploads that, when associated with a creditor, are shown | ||
# on the [billing request flow](#billing-requests-billing-request-flows) | ||
# payment pages. | ||
class Logo | ||
attr_reader :id | ||
|
||
# Initialize a logo resource instance | ||
# @param object [Hash] an object returned from the API | ||
def initialize(object, response = nil) | ||
@object = object | ||
|
||
@id = object['id'] | ||
@response = response | ||
end | ||
|
||
def api_response | ||
ApiResponse.new(@response) | ||
end | ||
|
||
# Provides the logo resource as a hash of all its readable attributes | ||
def to_h | ||
@object | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
require_relative './base_service' | ||
|
||
# encoding: utf-8 | ||
# | ||
# This client is automatically generated from a template and JSON schema definition. | ||
# See https://github.com/gocardless/gocardless-pro-ruby#contributing before editing. | ||
# | ||
|
||
module GoCardlessPro | ||
module Services | ||
# Service for making requests to the Logo endpoints | ||
class LogosService < BaseService | ||
private | ||
|
||
# Unenvelope the response of the body using the service's `envelope_key` | ||
# | ||
# @param body [Hash] | ||
def unenvelope_body(body) | ||
body[envelope_key] || body['data'] | ||
end | ||
|
||
# return the key which API responses will envelope data under | ||
def envelope_key | ||
'logos' | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
require 'spec_helper' | ||
|
||
describe GoCardlessPro::Resources::Logo do | ||
let(:client) do | ||
GoCardlessPro::Client.new( | ||
access_token: 'SECRET_TOKEN' | ||
) | ||
end | ||
|
||
let(:response_headers) { { 'Content-Type' => 'application/json' } } | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
require 'spec_helper' | ||
|
||
describe GoCardlessPro::Services::LogosService do | ||
let(:client) do | ||
GoCardlessPro::Client.new( | ||
access_token: 'SECRET_TOKEN' | ||
) | ||
end | ||
|
||
let(:response_headers) { { 'Content-Type' => 'application/json' } } | ||
end |