Coder Social home page Coder Social logo

helu's Introduction

Helu

Build Status

In-App purchases for RubyMotion.

Money

Installation

Add this line to your application's Gemfile:

gem 'helu'

And then execute:

$ bundle

Or install it yourself as:

$ gem install helu

USAGE

Start a helu with the In App Purchase ID:

@helu = Helu.new("loosing_weight_10")

create blocks for failing and buying:

@helu.fail = lambda { |transaction| puts transaction ; # node here for failed in app purchase }
@helu.winning = lambda { |transaction| puts transaction ; # code here for successful in app purchase }

also for restoring in app purchases

 @helu.restore = lambda { restoring_method }

The transaction object on the lambda is the one we get from Apple; Therefore, it is a SKPaymentTransaction. More information about it here

buy the product:

@helu.buy

restore the product:

@helu.restore

Make sure that if your code ever throws out the Helu object, it better also close the store before doing so.

@helu.close

Supported types of In App Purchases

  • Consumables and Non-Consumables are supported.
  • Auto-Renewable subscriptions and Non-Renewing Subscriptions are not supported yet. However, we would love some help making it happen.

Requesting product information:

Asynchronous, raw:

inapps = %w[first second third]
@x = Helu::ProductInfoFetcher.new(inapps) do |pi|
  p pi
end

Asynchronous, wrapped in method call:

Helu::ProductInfoFetcher.fetch(inapps) do |pi|
  p pi
end

Synchronous:

pi = Helu::ProductInfoFetcher.fetch(inapps)
p pi

All three calls return hash of the following form:

{
  "inapp_id": {
    id: "inapp_id",
    title: "inapp_localized_title",
    description: "inapp_localized_description",
    price: "0.89", # float
    currency: "EUR",
    price_str: "\u20AC0.89",
  }, # .... 
}

Example App:

You can find an example app here. Remember that for this to work properly, you must add your app identifier to the Rakefile.

License

Helu is relase under the MIT license.

Credits

Ivan Acosta-Rubio | Initial work Michal J. | Product Info Fetcher Simon Traels Ravn | Removing Observer and Bug fixes.

helu's People

Contributors

bellatrixmartinez avatar cacique-coder avatar hasclass avatar ivanacostarubio avatar traels avatar wejn avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.