Skip to content

Commit

Permalink
Merge pull request #154 from blakeprudhomme/reason-codes
Browse files Browse the repository at this point in the history
Expose access to Reason Codes
  • Loading branch information
lscoates authored Jul 18, 2017
2 parents b630675 + 965c6f5 commit f4853d9
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 0 deletions.
15 changes: 15 additions & 0 deletions examples/reason_codes.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
$: << File.expand_path(File.dirname(__FILE__) + '/../lib')

require 'chargify_api_ares'

# You could load your credentials from a file...
chargify_config = YAML::load_file(File.join(File.dirname(__FILE__), '..', 'chargify.yml'))

Chargify.configure do |c|
c.subdomain = chargify_config['subdomain']
c.api_key = chargify_config['api_key']
end

# Retrieve a list of all your site's reason_codes
reason_codes = Chargify::ReasonCode.find(:all)
#[#<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>]
1 change: 1 addition & 0 deletions lib/chargify_api_ares.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
require 'chargify_api_ares/resources/payment_profile'
require 'chargify_api_ares/resources/product'
require 'chargify_api_ares/resources/product_family'
require 'chargify_api_ares/resources/reason_code'
require 'chargify_api_ares/resources/renewal_preview'
require 'chargify_api_ares/resources/site'
require 'chargify_api_ares/resources/statement'
Expand Down
5 changes: 5 additions & 0 deletions lib/chargify_api_ares/resources/reason_code.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
module Chargify
class ReasonCode < Base
include ResponseHelper
end
end

0 comments on commit f4853d9

Please sign in to comment.