README.md in printreleaf-1.0.3 vs README.md in printreleaf-1.3.0

- old
+ new

@@ -52,15 +52,15 @@ account.accounts_count #=> 2 account.users_count #=> 2 account.mtd_pages #=> 1234 account.qtd_pages #=> 12345 account.ytd_pages #=> 123456 -account.lifetime_pages #=> 1234567 +account.ltd_pages #=> 1234567 account.mtd_trees #=> 0.15 account.qtd_trees #=> 1.48 account.ytd_trees #=> 14.82 -account.lifetime_trees #=> 148.1 +account.ltd_trees #=> 148.1 ``` ### Listing Accounts ```ruby @@ -146,12 +146,12 @@ deposit = account.deposits.find("a86d591c-3c29-4bef-82c3-7a007fb6b19c") #=> #<PrintReleaf::Deposit> deposit.id #=> "a86d591c-3c29-4bef-82c3-7a007fb6b19c" deposit.account_id #=> "971d10ac-a912-42c0-aa41-f55adc7b6755" deposit.account #=> #<PrintReleaf::Account> -deposit.source_id #=> "44e182ed-cd50-4fa1-af90-e77dd6d6a78c" -deposit.source #=> #<PrintReleaf::Source> +deposit.feed_id #=> "44e182ed-cd50-4fa1-af90-e77dd6d6a78c" +deposit.feed #=> #<PrintReleaf::Feed> deposit.date #=> "2016-07-05T12:29:12Z" deposit.pages #=> 20000 deposit.width #=> 0.2127 deposit.height #=> 0.2762 deposit.density #=> 216.0 @@ -207,10 +207,68 @@ ```ruby invitation.delete #=> true ``` +## Quotes + +### Listing Quotes + +```ruby +PrintReleaf::Quote.list #=> [#<PrintReleaf::Quote>, #<PrintReleaf::Quote>] +# -or- +account.quotes #=> [#<PrintReleaf::Quote>, #<PrintReleaf::Quote>] +``` + +### Retrieving a Quote + +```ruby +quote = PrintReleaf::Quote.find("83d12ee9-a187-489d-a93f-3096238f1f86") #=> #<PrintReleaf::Quote> +# -or- +quote = account.quotes.find("83d12ee9-a187-489d-a93f-3096238f1f86") #=> #<PrintReleaf::Quote> + +quote.id #=> "83d12ee9-a187-489d-a93f-3096238f1f86" +quote.account_id #=> "971d10ac-a912-42c0-aa41-f55adc7b6755" +quote.created_at #=> "2015-10-22T01:52:12Z" +quote.account #=> #<PrintReleaf::Account> +quote.transaction_id #=> "70af5540-e3ec-4db7-bc45-4fb65b74368b" +quote.transaction #=> #<PrintReleaf::Transaction> +quote.trees #=> 63.048 +quote.standard_pages #=> 525377 +quote.msrp_rate #=> 0.0003 +quote.msrp_price #=> 157.61 +quote.items #=> [#<PrintReleaf::QuoteItem>, #<PrintReleaf::QuoteItem>] +``` + +### Creating a Quote + +```ruby +quote = PrintReleaf::Quote.create( + items: [ + { + quantity: 20000, + width: 0.2127, + height: 0.2762, + paper_type_id: "a11c7abc-011e-462f-babb-3c6375fa6473" + }, + { + quantity: 400000, + width: 0.2127, + height: 0.2762, + paper_type_id: "bbd0f271-2f9e-494c-b2af-7f9354b310ad" + } + ] +) #=> #<PrintReleaf::Quote> +``` + +### Deleting a Quote + +```ruby +quote.delete #=> true +``` + + ## Servers ### Listing Servers ```ruby @@ -260,77 +318,77 @@ ```ruby server.delete #=> true ``` -## Sources +## Feeds -### Listing Sources +### Listing Feeds ```ruby -PrintReleaf::Source.list #=> [#<PrintReleaf::Source>, #<PrintReleaf::Source>] +PrintReleaf::Feed.list #=> [#<PrintReleaf::Feed>, #<PrintReleaf::Feed>] # -or- -account.sources #=> [#<PrintReleaf::Source>, #<PrintReleaf::Source>] +account.feeds #=> [#<PrintReleaf::Feed>, #<PrintReleaf::Feed>] ``` -### Retrieving a Source +### Retrieving a Feed ```ruby -source = PrintReleaf::Source.find("44e182ed-cd50-4fa1-af90-e77dd6d6a78c") #=> #<PrintReleaf::Source> +feed = PrintReleaf::Feed.find("44e182ed-cd50-4fa1-af90-e77dd6d6a78c") #=> #<PrintReleaf::Feed> # -or- -source = account.sources.find("44e182ed-cd50-4fa1-af90-e77dd6d6a78c") #=> #<PrintReleaf::Source> +feed = account.feeds.find("44e182ed-cd50-4fa1-af90-e77dd6d6a78c") #=> #<PrintReleaf::Feed> -source.id #=> "44e182ed-cd50-4fa1-af90-e77dd6d6a78c" -source.account_id #=> "971d10ac-a912-42c0-aa41-f55adc7b6755" -source.account #=> #<PrintReleaf::Account> -source.type #=> "fmaudit" -source.server_id #=> "eadabb78-b199-43cb-adbd-ab36ce5c5a10" -source.server #=> #<PrintReleaf::Server> -source.external_id #=> "456" -source.collection_scope #=> "managed_only" -source.created_at #=> "2016-03-07T00:04:09Z" -source.status #=> "active" -source.activated_at #=> "2016-03-07T00:04:09Z" -source.deactivated_at #=> nil -source.health_check #=> "healthy" -source.health_check_checked_at #=> "2017-03-07T00:04:09Z" -source.health_check_changed_at #=> "2017-03-07T00:04:09Z" +feed.id #=> "44e182ed-cd50-4fa1-af90-e77dd6d6a78c" +feed.account_id #=> "971d10ac-a912-42c0-aa41-f55adc7b6755" +feed.account #=> #<PrintReleaf::Account> +feed.type #=> "fmaudit" +feed.server_id #=> "eadabb78-b199-43cb-adbd-ab36ce5c5a10" +feed.server #=> #<PrintReleaf::Server> +feed.external_id #=> "456" +feed.collection_scope #=> "managed_only" +feed.created_at #=> "2016-03-07T00:04:09Z" +feed.status #=> "active" +feed.activated_at #=> "2016-03-07T00:04:09Z" +feed.deactivated_at #=> nil +feed.health_check #=> "healthy" +feed.health_check_checked_at #=> "2017-03-07T00:04:09Z" +feed.health_check_changed_at #=> "2017-03-07T00:04:09Z" ``` -### Creating a Source +### Creating a Feed ```ruby -source = PrintReleaf::Source.create( +feed = PrintReleaf::Feed.create( type: "printfleet", server_id: "9a6a1ced-4e71-4919-9d6d-25075834c404", external_id: "732ec0d3-20e3-439e-94e6-e64b40eb533a" -) #=> #<PrintReleaf::Source> +) #=> #<PrintReleaf::Feed> ``` -### Updating a Source +### Updating a Feed ```ruby -source.external_id = "abc123" -source.save #=> true +feed.external_id = "abc123" +feed.save #=> true ``` -### Activating a Source +### Activating a Feed ```ruby -source.activate #=> true +feed.activate #=> true ``` -### Deactivating a Source +### Deactivating a Feed ```ruby -source.deactivate #=> true +feed.deactivate #=> true ``` -### Deleting a Source +### Deleting a Feed ```ruby -source.delete #=> true +feed.delete #=> true ``` ## Transactions @@ -351,40 +409,32 @@ transaction.id #=> "70af5540-e3ec-4db7-bc45-4fb65b74368b" transaction.account_id #=> "971d10ac-a912-42c0-aa41-f55adc7b6755" transaction.account #=> #<PrintReleaf::Account> transaction.project_id #=> "692bb68d-64aa-4a79-8a08-d373fb0d8752" -transaction.account #=> #<PrintReleaf::Forestry::Project> +transaction.project #=> #<PrintReleaf::Forestry::Project> transaction.certificate_id #=> "70af5540-e3ec-4db7-bc45-4fb65b74368b" -transaction.account #=> #<PrintReleaf::Certificate> +transaction.certificate #=> #<PrintReleaf::Certificate> +transaction.quote_id #=> "83d12ee9-a187-489d-a93f-3096238f1f86" +transaction.quote #=> #<PrintReleaf::Quote> transaction.date #=> "2015-10-22T01:52:12Z" +transaction.pages #=> 525377 transaction.trees #=> 63.048 -transaction.items #=> [#<PrintReleaf::TransactionItem>, #<PrintReleaf::TransactionItem>] ``` ### Creating a Transaction ```ruby -# Providing only trees: +# By providing total number of pages: +transaction = PrintReleaf::Transaction.create(trees: 16000) #=> #<PrintReleaf::Transaction> + +# Or by providing total number of trees: transaction = PrintReleaf::Transaction.create(trees: 2.0) #=> #<PrintReleaf::Transaction> -# or providing raw paper specs: +# Or by providing a `quote_id` to convert a quote to a transaction transaction = PrintReleaf::Transaction.create( - items: [ - { - pages: 20000, - width: 0.2127, - height: 0.2762, - paper_type_id: "a11c7abc-011e-462f-babb-3c6375fa6473" - }, - { - pages: 400000, - width: 0.2127, - height: 0.2762, - paper_type_id: "bbd0f271-2f9e-494c-b2af-7f9354b310ad" - } - ] + quote_id: "83d12ee9-a187-489d-a93f-3096238f1f86" ) #=> #<PrintReleaf::Transaction> ``` ### Deleting a Transaction @@ -516,11 +566,11 @@ PrintReleaf will raise exceptions for most failure scenarios, including invalid parameters, authentication errors, and network errors. Most exceptions will inherit from `PrintReleaf::Error`, making it easy to gracefully handle all possible API exceptions. ```ruby begin - # Use PrintReleaf to make requests... + # Make requests... rescue PrintReleaf::RateLimitExceeded => e # Too many requests made to the API too quickly rescue PrintReleaf::BadRequest => e # Invalid parameters were supplied to PrintReleaf's API rescue PrintReleaf::Unauthorized => e @@ -559,7 +609,7 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/printreleaf/printreleaf-ruby. ## License -The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT). +The gem is available as open feed under the terms of the [MIT License](http://openfeed.org/licenses/MIT).