Skip to content

Commit f4853d9

Browse files
authored
Merge pull request #154 from blakeprudhomme/reason-codes
Expose access to Reason Codes
2 parents b630675 + 965c6f5 commit f4853d9

File tree

3 files changed

+21
-0
lines changed

3 files changed

+21
-0
lines changed

examples/reason_codes.rb

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
$: << File.expand_path(File.dirname(__FILE__) + '/../lib')
2+
3+
require 'chargify_api_ares'
4+
5+
# You could load your credentials from a file...
6+
chargify_config = YAML::load_file(File.join(File.dirname(__FILE__), '..', 'chargify.yml'))
7+
8+
Chargify.configure do |c|
9+
c.subdomain = chargify_config['subdomain']
10+
c.api_key = chargify_config['api_key']
11+
end
12+
13+
# Retrieve a list of all your site's reason_codes
14+
reason_codes = Chargify::ReasonCode.find(:all)
15+
#[#<Chargify::ReasonCode:0x007fb67da028d8 @attributes={"id"=>673, "site_id"=>11532, "code"=>"one", "description"=>"One for the money", "position"=>1, "created_at"=>"2017-04-10T04:17:21.000Z", "updated_at"=>"2017-04-10T04:19:30.000Z"}, @prefix_options={}, @persisted=true>, #<Chargify::ReasonCode:0x007fb67da02158 @attributes={"id"=>674, "site_id"=>11532, "code"=>"two", "description"=>"Two for the show", "position"=>2, "created_at"=>"2017-04-10T04:17:27.000Z", "updated_at"=>"2017-04-10T04:19:37.000Z"}, @prefix_options={}, @persisted=true>, #<Chargify::ReasonCode:0x007fb67da01a28 @attributes={"id"=>675, "site_id"=>11532, "code"=>"three", "description"=>"Three to get ready", "position"=>3, "created_at"=>"2017-04-10T04:17:38.000Z", "updated_at"=>"2017-04-10T04:19:43.000Z"}, @prefix_options={}, @persisted=true>, #<Chargify::ReasonCode:0x007fb67da012f8 @attributes={"id"=>681, "site_id"=>11532, "code"=>"four", "description"=>"Four to go", "position"=>4, "created_at"=>"2017-04-10T04:19:50.000Z", "updated_at"=>"2017-04-10T04:19:50.000Z"}, @prefix_options={}, @persisted=true>]

lib/chargify_api_ares.rb

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
require 'chargify_api_ares/resources/payment_profile'
1818
require 'chargify_api_ares/resources/product'
1919
require 'chargify_api_ares/resources/product_family'
20+
require 'chargify_api_ares/resources/reason_code'
2021
require 'chargify_api_ares/resources/renewal_preview'
2122
require 'chargify_api_ares/resources/site'
2223
require 'chargify_api_ares/resources/statement'
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module Chargify
2+
class ReasonCode < Base
3+
include ResponseHelper
4+
end
5+
end

0 commit comments

Comments
 (0)